【发布时间】:2016-06-14 01:54:22
【问题描述】:
我有以下layout.xml:
<LinearLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="50dp"
android:src="@drawable/logo"/>
...
</LinearLayout>
我这样设置父级LinearLayout的背景色:
LinearLayout layout = (LinearLayout) view.findViewById(R.id.layout);
layout.setBackgroundColor(Color.parseColor("#727272"));
layout.setAlpha(0.5f);
但是,ImageView (id:image) 是有色的。有没有办法在设置父布局的背景颜色时不给ImageView 着色?
【问题讨论】:
-
什么是 eventLogoLayout?
-
为什么要设置 eventLogoLayout.setAlpha(0.5f)?它的着色可能取决于您的徽标。您必须在此处附上您的屏幕截图。
-
设置 ImageView 背景 = null。可能对你有帮助
-
@Mark Shen,是布局。已更新。
-
@Konstantin,我不明白你设置 ImageView 背景 = null 的意思,因为我必须为 imageView 设置图像。我尝试在imageView中设置android:background="@color/transparent",但是不起作用。
标签: android android-layout android-imageview