我想在远程视图中以编程方式更改图像视图的alpha值,但这根本没有任何效果。
我如何分配它:
v.setInt(vR.id.imageView, "setAlpha", alpha);我如何声明它:
<ImageView
android:id="@+id/widget_agenda_bg_dark"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dip"
android:src ="@drawable/background"
android:scaleType="fitXY"/>资源bg是一个形状:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="0dp" android:color="#FFFFFFFF" />
<gradient android:startColor="#FF000000" android:endColor="#FF7A7A7A"
android:angle="315"/>
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape> 一切都显示正确,没有抛出任何错误,但它仍然不会改变alpha值…有什么想法吗?
发布于 2012-02-15 00:15:03
我不知道setInt方法,但是您在渐变中使用了android:startColor="#FF000000“,其中前两个字母"FF”表示不透明度,其他六个字母定义十六进制颜色。
如果你声明android:startColor="#00000000“,你的startColor将是完全不可见的,像android:startColor="#80000000”这样的东西将会变得有点透明。
https://stackoverflow.com/questions/9279636
复制相似问题