Android如何实现进度条-进度圆角

xewenfung 2012-07-31 09:33:26

请问android 如何实现这样的进度条, 请注意: 进度条进度的 那个“圆角”, 请各位大侠帮忙,谢谢

我知道进度条本身可以通过xml 修改成圆角的, 但是进度我不清除怎么设置
...全文
453 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
xewenfung 2012-08-10
  • 打赏
  • 举报
回复
楼上的,你那种方法是可以的,况且我还有一种方法.如下:
我把两个进度条通过相对布局,重叠在一起, 然后直接动态改变上面那个进度条的长度也可以实现的。

我只是想知道,有没有使用进度条本身实现这样的效果的,不想用别的方法,先谢谢楼上了。
AMinfo 2012-08-09
  • 打赏
  • 举报
回复
补充

<LinearLayout android:id="@+id/centerLayout"
android:layout_width="0px"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/centerPic">



</LinearLayout>

这个地方的android:layout_height="wrap_content"改为android:layout_height="中间那个图片的高度"
AMinfo 2012-08-09
  • 打赏
  • 举报
回复
给你一个小提示:

将这个进度条的左边圆角和右边的圆角部份分别做成2个图,中间部份的切成一个图
假设
左图文件名为leftPic.png,
中间的图名为centerPic.png
左图文件名为rightPic.png

通过布局来实现,布局内容如下:

<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<ImageView android:id="@+id/leftPic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/leftPic"/>

</LinearLayout>

<LinearLayout android:id="@+id/centerLayout"
android:layout_width="0px"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/centerPic">



</LinearLayout>

<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">

<ImageView android:id="@+id/rightPic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rightPic"/>

</LinearLayout>
</LinearLayout>


然后在代码中通过获取centerLayout这个LinearLayout,并通过改变centerLayout的宽度来实现进度条效果。
J2EE程序员 2012-08-09
  • 打赏
  • 举报
回复
嘻嘻 同求 ~
xewenfung 2012-08-09
  • 打赏
  • 举报
回复
大家顶起来呀,谢谢各位
flying_vip_521 2012-08-02
  • 打赏
  • 举报
回复
这个还真不知道,顶起,求解

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧