<!-- Sets the text styles -->
<?xml version="1.0" encoding="utf-8"?>
<!-- Sets the text styles -->
<resources>
<style name="CustomWindowTitleText" parent="android:TextAppearance.WindowTitle">
<item name="android:textSize">20dip</item>
<item name="android:textColor">#5599FF</item>
<item name="android:textStyle">bold|italic</item>
</style>
<!-- Changes the background color of the title bar -->
<style name="CustomWindowTitleBackground">
<item name="android:background">#222222</item>
</style>
<!-- Set the theme for the window title -->
<!-- NOTE: setting android:textAppearence to style defined above -->
<style name="CustomWindowTitle" parent="android:WindowTitle">
<item name="android:textAppearance">@style/CustomWindowTitleText</item>
<item name="android:shadowDx">0</item>
<item name="android:shadowDy">0</item>
<item name="android:shadowRadius">5</item>
<item name="android:shadowColor">#1155CC</item>
</style>
<!-- Override properties in the default theme -->
<!-- NOTE: you must explicitly the windowTitleSize property, the title bar will not re-size automatically, text will be clipped -->
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">40dip</item>
<item name="android:windowTitleStyle">@style/CustomWindowTitle</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
</resources>
1.<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="foodRatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/food_ratingbar_full</item>
<item name="android:minHeight">48dip</item>
<item name="android:maxHeight">48dip</item>
</style>
</resources>
2.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+android:id/background"
android:drawable="@drawable/food_ratingbar_full_empty" />
<item android:id="@+android:id/secondaryProgress"
android:drawable="@drawable/food_ratingbar_full_empty" />
<item android:id="@+android:id/progress"
android:drawable="@drawable/food_ratingbar_full_filled" />
</layer-list>
3.
<?xml version="1.0" encoding="utf-8"?>
<!-- This is the rating bar drawable that is used to
show a filled cookie. -->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/cookie" />
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/cookie" />
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/cookie" />
<item android:drawable="@drawable/cookie" />
</selector>
4.
<RatingBar android:id="@+id/my_rating_bar"
...
/>
setContentView(R.layout.main);
TextView textView = (TextView) findViewById(R.id.textview);
SpannableString ss = new SpannableString("abc");
Drawable d = getResources().getDrawable(R.drawable.icon32);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
ss.setSpan(span, 0, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
textView.setText(ss);