Created
April 8, 2018 10:31
-
-
Save maiconhellmann/971c48a0d54c8d04aeac4cb44d44e949 to your computer and use it in GitHub Desktop.
RadioButton with a behavior of a ToggleButton or TabButton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_checked="true"> | |
<shape android:shape="rectangle"> | |
<solid android:color="#3B5A9A" /> | |
<corners android:bottomLeftRadius="4dp" | |
android:topLeftRadius="4dp"/> | |
</shape> | |
</item> | |
<item> | |
<shape android:shape="rectangle"> | |
<solid android:color="#00000000" /> | |
<corners android:bottomLeftRadius="4dp" | |
android:topLeftRadius="4dp"/> | |
</shape> | |
</item> | |
</selector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_checked="true"> | |
<shape android:shape="rectangle"> | |
<solid android:color="#3B5A9A" /> | |
<corners android:bottomRightRadius="4dp" | |
android:topRightRadius="4dp"/> | |
</shape> | |
</item> | |
<item> | |
<shape android:shape="rectangle"> | |
<solid android:color="#00000000" /> | |
<corners android:bottomRightRadius="4dp" | |
android:topRightRadius="4dp"/> | |
</shape> | |
</item> | |
</selector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<RadioGroup | |
android:id="@+id/rgTask" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@drawable/round_border" | |
android:orientation="horizontal" | |
android:weightSum="2" | |
android:layout_margin="10dp" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
> | |
<RadioButton | |
android:id="@+id/rbBlue" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:background="@drawable/bg_radio_toggle_left" | |
android:button="@android:color/transparent" | |
android:gravity="center" | |
android:paddingBottom="5dp" | |
android:paddingTop="5dp" | |
android:singleLine="true" | |
tools:text="Grêmio" | |
android:checked="true" | |
android:textColor="@color/white" | |
/> | |
<View | |
android:id="@+id/vSep1" | |
android:layout_width="1dp" | |
android:layout_height="match_parent" | |
android:background="#0000FF" | |
android:visibility="visible" /> | |
<RadioButton | |
android:id="@+id/rbGreen" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:background="@drawable/bg_radio_toggle_right" | |
android:button="@android:color/transparent" | |
android:gravity="center" | |
android:paddingBottom="5dp" | |
android:paddingTop="5dp" | |
android:singleLine="true" | |
tools:text="Internacional" | |
android:checked="false"/> | |
</RadioGroup> | |
</android.support.constraint.ConstraintLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment