android - Changing background color in a activity. -
i used android studio create basic activity using new -> activity -> basic activity. activity background colour black. know reduce battery consumption. there way change white colour, without changing style.
i tried change background colour of root layout, won't show hint text of edit text field. because it's colour white.
then tried change theme material material lite, wouldn't show change when run app in device.
here activity declaration in androidmanifest.xml
<activity android:name=".searchbus" android:label="@string/title_activity_search_bus" android:parentactivityname=".mapsactivity" > <meta-data android:name="android.support.parent_activity" android:value="uk.co.stableweb.iroute.mapsactivity" /> </activity>
in styles.xml
set android:windowbackground
attribute whatever theme using application or activity. can find theme using in androidmanifest.xml.
<resources xmlns:tools="http://schemas.android.com/tools"> <!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.noactionbar"> <!-- customize theme here. --> <item name="android:windowbackground">@color/somecolor</item> </style> </resources>
note: if have views in layout aren't transparent, block seeing color set here.
Comments
Post a Comment