Android window title bar icon is causing background for list view items
Programmatic setting the window title bar icon is causing every list view item has tile bar icon as background.
setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ball);
How can i remove the listview background image or set the window title bar icon any other way than programmatic?
With window title icon set
With out window title icon
--UPDATE
<?xml version="1.0" encoding="utf-8"?>
<!-- Sets the text styles -->
<resources>
<style name="CustomWindowTitleText" parent="android:TextAppearance.WindowTitle">
<item name="android:textSize">24dip</item>
<item name="android:textColor">#ffffff</item>
<item name="android:textStyle">bold</item>
<item name="android:typeface">normal</item>
</style>
<!-- Changes the background color of the title bar -->
<style name="CustomWindowTitleBackground">
<item name="android:background">@drawable/bg_gradient_05</item>
<item name="android:paddingLeft">10dp</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">0</item>
<item name="android:shadowColor">#a0a0a0</item>
</style>
<!-- Override properties in the default them开发者_如何学运维e -->
<!-- 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">50dip</item>
<item name="android:windowTitleStyle">@style/CustomWindowTitle</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
</resources>
Use the following code
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.my_layout);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
Please be sure that you are using requestWindowFeature
before setContentView
.Here in R.layout.custom_title
use your custom title xml.
I think this will help you.
精彩评论