忽略 parent 查看背景?
Ignore parent View background?
在现实世界中,示例控制面板布局(下方)出现在其自己的 FrameLayout(片段容器)中,并且(取决于应用程序是否 运行 在平板电脑上)与地图一起显示,地图的颜色由 'colour' 按钮触发的颜色选择器设置。 (注意:地图和控制面板的背景不同。)
在颜色选择器 return 上,关联的地图粒子和按钮背景会更新为新颜色。
想法是(根据用户的观察)按钮的颜色与地图完全匹配。
当然,事实并非如此! (除非选择的颜色有 255-alpha)。
我知道这是 'expected behaviour' 但是否有一个巧妙的(或 'hacky')技巧可以消除 parent 背景(仅在按钮 child 后面)所以child 背景颜色是否正确呈现?
示例控制面板布局和代码
<LinearLayout android:id="@+id/settingsLL"
android:orientation="vertical">
<LinearLayout android:id="@+id/oneOfMany"
android:orientation="horizontal">
<TextView style="@style/wptedit_title" android:text="[some title]" />
<Button style="@style/wptedit_color" android:id="@+id/colorBtn" />
</LinearLayout>
</LinearLayout>
// Control panel background
settingsLL.setBackgroundColor(0xFFD5FFDD);
// Faint red tint gives desired map background not reflected by button
colorBtn.setBackgroundColor(0x04FF0000);
在现实世界中,示例控制面板布局(下方)出现在其自己的 FrameLayout(片段容器)中,并且(取决于应用程序是否 运行 在平板电脑上)与地图一起显示,地图的颜色由 'colour' 按钮触发的颜色选择器设置。 (注意:地图和控制面板的背景不同。)
在颜色选择器 return 上,关联的地图粒子和按钮背景会更新为新颜色。
想法是(根据用户的观察)按钮的颜色与地图完全匹配。
当然,事实并非如此! (除非选择的颜色有 255-alpha)。
我知道这是 'expected behaviour' 但是否有一个巧妙的(或 'hacky')技巧可以消除 parent 背景(仅在按钮 child 后面)所以child 背景颜色是否正确呈现?
示例控制面板布局和代码
<LinearLayout android:id="@+id/settingsLL"
android:orientation="vertical">
<LinearLayout android:id="@+id/oneOfMany"
android:orientation="horizontal">
<TextView style="@style/wptedit_title" android:text="[some title]" />
<Button style="@style/wptedit_color" android:id="@+id/colorBtn" />
</LinearLayout>
</LinearLayout>
// Control panel background
settingsLL.setBackgroundColor(0xFFD5FFDD);
// Faint red tint gives desired map background not reflected by button
colorBtn.setBackgroundColor(0x04FF0000);