I am using SlidingTabs
to create two tabs. The UI of the tab should appear like this -
When first tab is selected
When second tab is selected.
(Please note the straight corners of the blue rectangle)
I am using the following selector to create the UI shown above.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Active tab -->
<item android:state_selected="true" android:state_focused="false"
android:state_pressed="false" android:drawable="@drawable/round_corner_rectangle" />
<!-- Inactive tab -->
<item android:state_selected="false" android:state_focused="false"
android:state_pressed="false" android:drawable="@android:color/transparent" />
<!-- Pressed tab -->
<item android:state_pressed="true" android:state_selected="true" android:drawable="@drawable/round_corner_rectangle" />
<item android:state_pressed="true" android:state_selected="false" android:drawable="@color/transparent" />
<!-- Selected tab (using d-pad) -->
<item android:state_focused="true" android:state_selected="true"
android:state_pressed="false" android:drawable="@android:color/transparent" />
</selector>
round_corner_rectangle
's code is as follows-
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp"/>
<solid android:color="@color/login_background" />
</shape>
login_background
is the dark blue color. Using the above code, I am getting the following-
I can ofcourse remove the corner
item from round_corner_rectangle
to get the dark blue background straight instead of round. If I make right side of blue rectangle straight, when the other tab is selected, the rectangle is rounded on wrong side.
What should I do to get the UI like shown in the first image?
Update:- As you can see from my code, I don't have issue in creating round corners, the issue is having straight corners on the selected tab. If I simply add round corners, when a second tab is selected, the corners are rounded on the wrong side.