Creating an action with the same background as ICS / Preferences

I am working on an application for ICS, and I would like my activity to have the same background as the settings, with a steep gradient.

I tried Theme.DeviceDefault and some others, but I can not get it.

Is this possible or should I forget?

enter image description here

+4
source share
3 answers

I needed 2 things:

<uses-sdk android:targetSdkVersion="11"/> <application android:hardwareAccelerated="true" (...)/> 

Now it works fine.

0
source

It is easier to create this background file directly.

range hood / app_background_ics.xml

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle="270" android:startColor="@color/ics_background_start" android:endColor="@color/ics_background_end" android:type="linear" /> </shape> 

values ​​/ colors.xml

 <?xml version="1.0" encoding="UTF-8"?> <resources> <color name="ics_background_start">#ff020202</color> <color name="ics_background_end">#ff272D33</color> </resources> 

Then add app_background_ics as the background for your main view (in this example ListView). Don't forget transparent android: cacheColorHint to avoid rough background when scrolling in ListView

  <ListView android:id="@+id/video_list" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:dividerHeight="2dip" android:background="@drawable/app_background_ics" android:cacheColorHint="#00000000"/> 
+13
source

Have you tried Theme.Holo.Dark ?

0
source

Source: https://habr.com/ru/post/1394424/


All Articles