I use SlidingTabs to create two tabs. The tab user interface should look like this:
When the first tab is selected 
When the second tab is selected. 
(Pay attention to the right angles of the blue rectangle)
I use the following selector to create the user interface shown above.
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/round_corner_rectangle" /> <item android:state_selected="false" android:state_focused="false" android:state_pressed="false" android:drawable="@android:color/transparent" /> <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" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@android:color/transparent" /> </selector>
round_corner_rectangle 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 a dark blue color. Using the code above, I get the following:


I can, of course, remove the corner element from round_corner_rectangle to get a blue background instead of a straight line. If I make the right side of the blue rectangle straight when another tab is selected, the rectangle is rounded on the other side.
What should I do to get the interface as shown in the first image?
Update: - As you can see from my code, I have no problems creating round corners, the problem is related to right angles on the selected tab. If I just add round corners when the second tab is selected, the corners are rounded on the other side.
android android-layout pagerslidingtabstrip android-tabs
Rohan kandwal
source share