我尝试了一些方法,但没有任何效果...我试图更改 Android 上 ImageView 上的背景颜色,但没有任何反应...
这是我的 xml:
<ImageView
android:id="@+id/imageView1"
android:layout_width="350dp"
android:layout_height="550dp"
android:layout_above="@+id/btnInfo"
android:layout_alignLeft="@+id/fundo"
android:layout_alignRight="@+id/btnInfo"
android:layout_alignTop="@+id/fundo"
android:layout_centerHorizontal="true"
android:contentDescription="@string/backgroundMain" />
和代码:
public void onStart()
{
super.onStart();
Log.d("Teste", "In the onStart() event 5");
ImageView backgroundImg = (ImageView) findViewById(R.id.imageView1);
backgroundImg.setBackgroundColor(Color.rgb(255, 255, 255));
}
我缺少什么?
RGB:255, 255, 255 是白色的颜色代码。由于您的父布局背景颜色也是白色,因此您不会看到差异。
尝试改变颜色像
backgroundImg.setBackgroundColor(Color.rgb(100, 100, 50));
或者更改父布局的背景颜色。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)