我想自定义状态栏,以便它看起来这样的形象:Android的进度UI自定义布局
但是,一个良好的几个小时我只有后一个状态栏,与我只需要在后台(图像2):
当前代码我是: XML布局:
<ProgressBar
android:id="@+id/pBarOverallStatus"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="94"
android:indeterminateOnly="false"
android:max="100"
android:progressDrawable="@drawable/progress_bar_states" >
</ProgressBar>
的progress_bar_states.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- <item android:id="@android:id/progress">
<bitmap
android:gravity="center"
android:src="@drawable/progressbar_progressing" />
<corners android:radius="10dp" />
</item>
-->
</layer-list>
删除注释,其中proressbar_progressing看起来像 然后我有东西有点难看,因为没有角落。
我加入从代码的背景下,这样的:
overallStatus = (ProgressBar) findViewById(R.id.pBarOverallStatus);
Resources res = getResources();
overallStatus.setBackgroundDrawable(res.getDrawable(R.drawable.progressbar_background));
overallStatus.setProgress(50);
我试图角落添加到图像,但没有运气。 有没有人知道我在做什么错在这里?或者我错过了什么? 另外,你有什么想法,我怎么可以添加左,右环?资源:
我不知道下面的链接将是任何帮助,但我已经找到了很多关于谷歌的帖子问同样的问题,所以希望您可以从中汲取灵感的http:/ /blog.mediarain.com/2011/04/android-custom-progressbar-with-rounded-corners/ – Mimminito 2012-03-29 08:34:45
谢谢!我没有得到我需要的确切结果,但我越来越接近。谢谢! – gunar 2012-03-30 17:07:15