Reputation: 19854
I have finished coding the logic of my application, which contains a GridView, a few TextViews and a few dialogs.
I now wish to style these views, as the default theme is somewhat ugly.
I've had a look at the provided Android themes, and tried out a few of them but they didn't really offer much. Therefore, I'm wondering if there are any resources available that would allow me to quickly apply a pre-defined thene and I could then tweak it accordingly? The ability to switch between a few stylish themes to get ideas and tweak them would be very beneficial as I am not the most graphical-minded.
Thanks
Upvotes: 2
Views: 4864
Reputation: 11437
Here what I do to style my dialogs differently. I first define a shape which gives be a gradient filled background and rounded edges:
filled_roundededges_box.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:startColor="#353535"
android:endColor="#222222"
android:angle="90" />
<stroke android:width="2dp" android:color="#808080"/>
<corners android:radius="5dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
I then create a style using this shape:
styles.xml:
<style name="AppCustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/filled_roundededges_box</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowSoftInputMode">stateVisible</item>
</style>
Finally I apply this style to my button:
<ImageButton
android:id="@+id/addedit_btnPrev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:src="@drawable/left"
style="@style/App_ButtonStyle" />
Alternatively you can apply the style as a theme to the who app using:
<application
android:icon="@drawable/ic_launcher_noteit1"
android:label="@string/app_name"
android:theme="@style/App_Theme"
android:name="NoteItApplication"
android:debuggable="true">
Upvotes: 2