【发布时间】:2016-05-11 21:57:59
【问题描述】:
我加载具有以下布局的首选项屏幕:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/export_main_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/windowBackground"
android:clickable="true">
<ImageView
android:id="@+id/export_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/entry_background" />
<android.support.v7.widget.RecyclerView
android:id="@+id/export_settings_list"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/export_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_file_upload_white_24"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:clickable="true"/>
</RelativeLayout>
RecyclerView 是扩展 XML 首选项文件的列表。其余的布局,FAB 和 ImageView,只是为了自定义首选项屏幕而添加的。
所有这些都在最新的 Android 版本上运行良好,但在 ICS 和 Jelly Bean(我没有尝试过 Kikat)上,FloatingActionButton 无法接收任何点击并且变得有点透明。
我尝试了十几种不同的方法(使用标准按钮、标准 lisview 等),但按钮在屏幕上仍然无用,总是单击下面的列表项。
我认为问题可能来自于我膨胀了一个 XML 首选项文件,因为我使用标准列表创建了相同的布局,并且该按钮在任何版本中都可以正常工作。
最坏的情况我只会为旧版本加载一个特定的布局......
【问题讨论】: