Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓如何动态更改整个FrameLayout的颜色,而不仅仅是视图背面的颜色?_Android_View_Background_Android Framelayout - Fatal编程技术网

Android 安卓如何动态更改整个FrameLayout的颜色,而不仅仅是视图背面的颜色?

Android 安卓如何动态更改整个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

这是我的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"
    >

<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);