Hello you today Code Android Example will be presented to you on how to custom button multiple colors in android a simple way, there are now many functions use the button in Android a lot because it has many uses for real alongside it easy to custom button color in android, for now you need to find out the keywords custom button gradient in Android , then the contents of the Android example as follows:
Perform you need to have things following:
Step 2. Select a color in Value -> Color.xml
Custom_buttom_color_1.xml
Result:
Custom_buttom_color_2.xml
Custom_buttom_color_3.xml
Custom_buttom_color_4.xml
Step 4. Perform additional print Button Android at activity_main file. xml folder layout in
Perform you need to have things following:
Search for the most beautiful colors
Android Settings studio
Settings or perform machine genymotion Android shirt in studio.
Steps multipe color printing custom button android
Step 1. Create an Android Project MultipleColor print studio as follows:Step 2. Select a color in Value -> Color.xml
<?xml version="1.0" encoding="utf-8"?>Step 3. Perform custom folder printing color drawable buttom
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="red">#F6402C</color>
<color name="pink">#EB1460</color>
<color name="purple">#9C1AB1</color>
<color name="deep_purple">#6633B9</color>
<color name="indigo">#3D4DB7</color>
<color name="blue">#1093F5</color>
<color name="light_blue">#00A6F6</color>
<color name="cyan">#00BBD5</color>
<color name="teal">#009687</color>
<color name="green">#46AF4A</color>
<color name="light_green">#9acd32</color>
<color name="lime">#CCDD1E</color>
<color name="yellow">#FFEC16</color>
<color name="amber">#FFC100</color>
<color name="orange">#FF9800</color>
<color name="deep_orange">#FF5505</color>
<color name="brown">#7A5547</color>
<color name="grey">#9D9D9D</color>
<color name="blue_grey">#5E7C8B</color>
<color name="white">#ffffff</color>
<color name="black">#000000</color>
<color name="crop__button_bar">#f3f3f3</color>
<color name="crop__button_text">#666666</color>
<color name="crop__selector_pressed">#1a000000</color>
<color name="crop__selector_focused">#77000000</color>
</resources>
Custom_buttom_color_1.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:centerColor="@color/deep_purple"
android:centerX="50%"
android:endColor="@color/light_green"
android:startColor="@color/blue_grey"
></gradient>
<corners android:radius="15dp" />
</shape>
</item>
</selector>
Result:
Custom_buttom_color_2.xml
<?xml version="1.0" encoding="utf-8"?>Result
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:centerColor="@color/red"
android:centerX="50%"
android:endColor="@color/lime"
android:startColor="@color/white"
></gradient>
<corners android:radius="15dp" />
</shape>
</item>
</selector>
Custom_buttom_color_3.xml
<?xml version="1.0" encoding="utf-8"?>Result:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:centerColor="@color/brown"
android:centerX="50%"
android:endColor="@color/yellow"
android:startColor="@color/crop__button_text"
></gradient>
<corners android:radius="15dp" />
</shape>
</item>
</selector>
Custom_buttom_color_4.xml
<?xml version="1.0" encoding="utf-8"?>Result
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:centerColor="@color/indigo"
android:centerX="50%"
android:endColor="@color/purple"
android:startColor="@color/colorPrimary"
></gradient>
<corners android:radius="15dp" />
</shape>
</item>
</selector>
Step 4. Perform additional print Button Android at activity_main file. xml folder layout in
<?xml version="1.0" encoding="utf-8"?>Step 5. make calls in class MainActivity.java Button Android example
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/btn_1"
android:text="Color Button"
android:textColor="@color/white"
android:layout_width="250dp"
android:layout_margin="10dp"
android:layout_centerHorizontal="true"
android:background="@drawable/custom_button_color"
android:layout_height="150dp" />
<Button
android:id="@+id/btn_2"
android:text="Color Button"
android:textColor="@color/white"
android:layout_width="250dp"
android:layout_below="@+id/btn_1"
android:layout_margin="10dp"
android:layout_centerHorizontal="true"
android:background="@drawable/custom_button_color_2"
android:layout_height="150dp" />
<Button
android:id="@+id/btn_3"
android:text="Color Button"
android:textColor="@color/white"
android:layout_width="250dp"
android:layout_below="@+id/btn_2"
android:layout_margin="10dp"
android:layout_centerHorizontal="true"
android:background="@drawable/custom_button_color_3"
android:layout_height="150dp" />
<Button
android:id="@+id/btn_4"
android:text="Color Button"
android:textColor="@color/white"
android:layout_width="250dp"
android:layout_below="@+id/btn_3"
android:layout_margin="10dp"
android:layout_centerHorizontal="true"
android:background="@drawable/custom_button_color_4"
android:layout_height="150dp" />
</RelativeLayout>
@OverrideAbove is the introductory article for you on how to print custom gradient buttom android with many different colors, if the article is of interest to you please like and share your posts, if matter what you keep for yourselves feedback. Thank you.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
seri kurye
ReplyDeletemoto kurye
ilaç kurye
acil kurye
gece kurye
nöbetçi kurye
getir kurye
express kurye
uçak kurye
acil ilaç
uçak kargo
moto vale
getir kurye
ilaç kurye