android之FrameLayout属性foreground

来源:互联网 发布:php get请求 编辑:程序博客网 时间:2024/05/21 09:35

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布局
1 0