我的布局风格有一些问题,实际上在 Android 5.1.1 上它工作正常,当我按下 RelativeLayout 时,它上面的文本会改变颜色,所以它看起来像是被选中的,而且看起来更漂亮。
在 Android 7.0 中,当 RelativeLayout 为 onClick 或 onFocus 时,它会呈现出可怕的橙色,所以我希望它看起来像在 Android 5.1.1 中......

这是我在这个视图中的 xml 代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
tools:context=".MainActivity"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="UselessLeaf,UselessParent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
tools:ignore="InefficientWeight,ObsoleteLayoutParam,UselessLeaf"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rellay_cassa"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_weight="0.65"
android:background="@color/blueLight"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:focusable="true"
tools:ignore="NestedWeights,ObsoleteLayoutParam">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
tools:ignore="UselessParent">
<ImageView
android:id="@+id/imgCassa"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_cassa"
android:tint="@color/colorWhite"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgCassa"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="CASSA"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rellay_tasti"
android:layout_weight="0.55"
android:clickable="true"
android:background="@color/blueDark"
android:foreground="?attr/selectableItemBackground"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
tools:ignore="UselessParent">
<ImageView
android:id="@+id/imgTasti"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_tasti"
android:tint="@color/colorWhite"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgTasti"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="AGGIUNGI TASTI"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:layout_weight="1"
android:baselineAligned="false"
tools:ignore="ObsoleteLayoutParam">
<RelativeLayout
android:id="@+id/rellay_articoli"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="@color/blueDark"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:focusable="true"
tools:ignore="InefficientWeight,NestedWeights">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
tools:ignore="ObsoleteLayoutParam,UselessParent">
<ImageView
android:id="@+id/imgArticoli"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_articoli"
android:tint="@color/colorWhite"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgArticoli"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="AGGIUNGI ARTICOLI"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rellay_clienti"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blueLight"
android:layout_weight="0.55"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
tools:ignore="UselessParent">
<ImageView
android:id="@+id/imgClienti"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_clienti"
android:tint="@color/colorWhite"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgClienti"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="AGGIUNGI CLIENTI"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:layout_weight="1"
tools:ignore="ObsoleteLayoutParam"
android:baselineAligned="false">
<RelativeLayout
android:id="@+id/rellay_settings"
android:layout_width="347dp"
android:layout_height="match_parent"
android:layout_weight="0.65"
android:background="@color/blueLight"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
tools:ignore="InefficientWeight,NestedWeights,UselessParent"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/imgSettings"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_settings"
android:tint="@color/colorWhite"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgSettings"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="IMPOSTAZIONI"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rellay_exit"
android:layout_width="331dp"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="@color/red"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
tools:ignore="UselessParent">
<ImageView
android:id="@+id/imgExit"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_exit"
android:tint="@color/colorWhite"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgExit"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="USCITA"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
