【发布时间】:2013-07-23 07:20:08
【问题描述】:
我正在编辑以使问题更简单,希望这有助于获得准确的答案。
假设我有以下oval 形状:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:angle="270"
android:color="#FFFF0000"/>
<stroke android:width="3dp"
android:color="#FFAA0055"/>
</shape>
如何在活动类中以编程方式设置颜色?
【问题讨论】:
-
你把这个drawable设置成什么?
-
drawable 是
oval,是 ImageView 的背景。 -
如果问的这个问题太难了,有没有办法在画布上绘制多个图像并将分层的最终产品设置为视图的背景?
-
您可以通过扩展
View类并将其用作允许小部件重叠的布局中的base视图(RelativeLayout、FrameLayout)来实现此目的。在这个扩展的View类中,您可以draw multiple images onto a canvas。但是,在此之前,请先看看这个 --> Link(如果你还没有的话)。
标签: android android-layout shape