2015-07-12 168 views
0

我想为ProgressBar对话框自定义微调框,背景和文本颜色。ProgressDialog的自定义颜色和背景

我想通过4个和5个OS版本的style.xml来做到这一点。

什么是正确的父母主题和属性负责我的属性?

我不能使用自定义drawable来解决这个问题,因为样式不是通过标准style.xml定义的。

+0

你想从java文件或xml文件中这样做吗? – 2015-07-12 06:45:56

+0

[如何在Android中自定义进度条]可能的重复(http://stackoverflow.com/questions/16893209/how-to-customize-a-progress-bar-in-android) – 2015-07-12 06:52:51

+0

正如我所提到的,我想通过style.xml文件做到这一点。 –

回答

0

这里是微调的风格同样可以适用的进度条上,如果你需要使用一个可绘制文件,你可以使用它作为背景的例子为波纹管提示:

<!-- Border for spinners--> 
    <style name="spinner_style" parent="AppBaseTheme"> 
     <item name="android:background">@drawable/bg</item> 
     <item name="android:layout_marginLeft">10dp</item> 
     <item name="android:layout_marginRight">10dp</item> 
     <item name="android:layout_marginBottom">10dp</item> 
     <item name="android:paddingLeft">8dp</item> 
     <item name="android:paddingTop">5dp</item> 
     <item name="android:paddingBottom">5dp</item> 
     <item name="android:popupBackground">#CECCCD</item> 

    </style> 

bg.xml

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item><layer-list> 
     <item><shape> 
      <gradient android:angle="90" android:endColor="#ebebeb" android:startColor="#ebebeb" android:type="linear" /> 

      <stroke android:width="2dip" android:color="#32CD32" /> 
      <corners android:radius="10dip"/> 

      <padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp" /> 
     </shape></item> 
     <item ><bitmap android:gravity="bottom|right" android:src="@drawable/arrow" /> 
     </item> 
    </layer-list></item> 

</selector> 

箭头:

enter image description here

希望这会有所帮助。

相关问题