android:progressDrawable的作用
来源:互联网 发布:七天网络阅卷查分登录 编辑:程序博客网 时间:2024/05/16 03:49
效果图:
上为:SeekBar
下为:ProgressBar
布局:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <SeekBar android:id="@+id/sb" android:layout_width="match_parent" android:layout_height="30dp" android:progressDrawable="@drawable/layer_list_seekbar" /> <ProgressBar android:id="@+id/pb" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="30dp" android:progressDrawable="@drawable/layer_list_progressbar" /></LinearLayout>
注意:
android:progressDrawable="@drawable/layer_list_progressbar"
该属性: 设置进度中的背景颜色和进度颜色
layer_list_seekbar
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="3dp" /> <gradient android:angle="270" android:centerColor="#2B2B2B" android:centerY="0.75" android:endColor="#ff747674" android:startColor="#ff9d9e9d" /> <solid android:color="#2B2B2B" /> </shape> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="3dp" /> <gradient android:angle="270" android:centerColor="#ff3399CC" android:centerY="0.75" android:endColor="#ff6699CC" android:startColor="#ff0099CC" /> <solid android:color="#2496F6" /> </shape> </clip> </item></layer-list>
layer_list_progressbar
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="2dp" /> <gradient android:angle="270" android:centerColor="@color/colorPrimaryDark" android:endColor="#ff4801" android:startColor="#f5f5f5" /> </shape> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="2dp" /> <gradient android:centerColor="#ff7612" android:endColor="#ff7612" android:startColor="#ff7612" /> </shape> </clip> </item></layer-list>
注意:
<item android:id="@android:id/background">设置背景 <item android:id="@android:id/progress">设置进度
MainActivity
public class MainActivity extends AppCompatActivity { private ProgressBar mPb; private SeekBar mSb; @RequiresApi(api = Build.VERSION_CODES.N) @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPb = ((ProgressBar) this.findViewById(R.id.pb)); mSb = ((SeekBar) this.findViewById(R.id.sb)); mSb.setProgress(50); mPb.setProgress(50, true); }}
阅读全文
0 0
- android:progressDrawable的作用
- ProgressBar的progressDrawable
- 关于Android中seekbar中progressDrawable属性的用法
- android:layout_weight的作用
- Android Intent的作用
- android:layout_weight的作用
- xmlns:android的作用
- Android Application的作用
- android的Policymanager 作用
- Android Application的作用
- android NDK的作用
- android:layout_weight的作用
- Android Application的作用
- Android Application的作用
- android context的作用
- android Inflate 的作用
- Android Application的作用
- Android Application的作用
- mysql汇总
- android的炫酷动画框架
- 使用MySQL驱动进行数据库连接
- exec和match中的g标识
- mysql 支持 emoji
- android:progressDrawable的作用
- Maven和Gradle对比
- Iterator主要有三个方法:hasNext()、next()、remove()详解
- Lua调试器
- bzoj1455 罗马游戏(左偏树(可并堆)+ 并查集)
- SqlServer中in和exists的区别效率问题
- vw让overflow:auto页面滚动条出现时不跳动
- 外部中断
- 关于更改数据库 用户的命令