你有2个选择:
1:添加父线性布局:
父布局有backgroundcolor和
儿童布局有波纹效应
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical">
android:id="@+id/singleTextLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp"
android:text="Test"
android:textSize="30dp" />
android:id="@+id/singleImage"
android:layout_width="fill_parent"
android:layout_height="125dp"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp" />
2:Opton:
创建可绘制资源:bg_ripple.xml
一个在文件夹drawable
另一个在文件夹drawable-v21中
android:color="@color/gray">
然后将此资源设置为您的布局的背景:
android:background="@drawable/bg_ripple"