android之FrameLayout属性foreground
Framlayout的foreground属性用于设置点击时的前景色
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:clickable="true" android:focusable="true" android:foreground="@color/blue" android:layout_height="wrap_content">
View.class中的一段代码:
case R.styleable.View_foreground: if (targetSdkVersion >= VERSION_CODES.M || this instanceof FrameLayout) { setForeground(a.getDrawable(attr)); } break;说明在6.0及以上才有效,并且必须是Fragment布局