顯示具有 color 標籤的文章。 顯示所有文章
顯示具有 color 標籤的文章。 顯示所有文章

2016年8月11日 星期四

how to set the TextView hint color

36 how to set the TextView hint color?
android:textColorHint

How to change the Edittext bottom line Color?

How to change the Edittext bottom line Color?


<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
   <item name="colorControlNormal">#c5c5c5</item>
   <item name="colorControlActivated">@color/accent</item>
   <item name="colorControlHighlight">@color/accent</item>
</style>

2015年10月19日 星期一

Android color resource

1.create a color.xml file

2.set the color in the xml file

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorBackground">#c213a2</color>
    <color name="colorBackground2">#c213a2</color>
    <color name="colorBackground3">#c213a2</color>
    <color name="colorBackground4">#c213a2</color>
</resources>


3.use in the layout XML code
<
<TextView
        android:id="@+id/tv1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/colorBackground3"
        android:text="Hello World!" />


4. use in the hava program code



TextView tv= (TextView) findViewById(R.id.tv1);

 tv.setBackgroundColor(getResources().getColor(R.color.colorBackground2));