我想在图片视图的背景中显示进度条,这是否可能?请帮忙。
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:drawable="@drawable/custom_background1" />
<item android:id="@android:id/secondaryProgress">
<clip android:drawable="@drawable/custom_background2" />
</item>
<item android:id="@android:id/progress">
<clip android:drawable="@drawable/custom_background3" />
</item>
</layer-list>
在drawable中创建一个XML文件,然后在layout.xml中使用它
android:progressDrawable="@drawable/music_volume_seekbar_style"
你的意思是这个吗?
对于任何视图来说都是不可能的。但如果你有ImageView
,你可以使用方法ImageView.setAlpha(int)
。
你可以重叠两个视图(ImageView 和进度条)。将 ImageView 设置为 VISIBLE,将进度条默认设置为 GONE。
当需要时,可以使进度条可见。请注意,您需要将 ProgressBar 的背景设置为透明。
在此处查看有关如何使视图背景透明的更多信息:http://www.41post.com/4213/programming/android-transparent-or-translucent-view-background