Android 安卓如何动态更改整个FrameLayout的颜色,而不仅仅是视图背面的颜色?
这是我的main.xmlAndroid 安卓如何动态更改整个FrameLayout的颜色,而不仅仅是视图背面的颜色?,android,view,background,android-framelayout,Android,View,Background,Android Framelayout,这是我的main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF" > <I
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
>
<ImageButton android:background="@null" android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/sample" android:id="@+id/pressThisButton" android:layout_y="40px" android:layout_x="20px"></ImageButton>
</FrameLayout>
在FrameLayout中是否有方法更改视图背景和整个屏幕颜色
谢谢您的时间。您可以使用
findViewById
获得FrameLayout
并设置背景色。感谢您的快速响应。在我为我的框架布局分配了一个id之后,您的建议非常有效。再次感谢您的帮助。
private OnClickListener buttonClickListener = new OnClickListener()
{
public void onClick( View v )
{
v.setBackgroundColor(0xffff0000);