Android窗口标题栏图标导致列表视图项的背景

以编程方式设置窗口标题栏图标会导致每个列表视图项都具有平铺栏图标作为背景。
setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ball);
如何删除列表视图背景图像或设置窗口标题栏图标除程序之外的任何其他方式? 带窗口标题图标集 带窗外标题图标 --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 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">50dip</item>
           <item name="android:windowTitleStyle">@style/CustomWindowTitle</item>
           <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
      </style>
</resources>
    
已邀请:
使用以下代码
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.my_layout);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
请确保您在
setContentView
之前使用
requestWindowFeature
。在
R.layout.custom_title
中使用您的自定义标题xml。 我想这会对你有所帮助。     

要回复问题请先登录注册