Java 嵌套滚动视图上未显示FAB按钮
我正在尝试在嵌套的滚动视图中显示fab more按钮。我已经搜索了许多解决方案,但没有找到任何可以在右下角显示fab more按钮的解决方案Java 嵌套滚动视图上未显示FAB按钮,java,android,android-6.0-marshmallow,android-nestedscrollview,Java,Android,Android 6.0 Marshmallow,Android Nestedscrollview,我正在尝试在嵌套的滚动视图中显示fab more按钮。我已经搜索了许多解决方案,但没有找到任何可以在右下角显示fab more按钮的解决方案 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/bt_close"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:background="?attr/selectableItemBackgroundBorderless"
android:tint="@android:color/white"
app:srcCompat="@drawable/ic_close" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Filter All Order"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
android:textColor="@android:color/white" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:scrollingCache="true">
<LinearLayout
android:id="@+id/billBlock"
android:layout_width="match_parent"
android:layout_height="match_parent">
//many inner layout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/grey_10" />
<android.support.v7.widget.RecyclerView
android:id="@+id/print_payment_list"
android:layout_margin="10dp"
android:background="@color/grey_20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/fabFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_mic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_middle"
android:clickable="true"
android:tint="@color/grey_80"
app:backgroundTint="@color/grey_20"
app:fabSize="mini"
app:rippleColor="@android:color/white"
app:srcCompat="@drawable/ic_mic" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_middle"
android:clickable="true"
android:tint="@color/grey_80"
app:backgroundTint="@color/grey_20"
app:fabSize="mini"
app:rippleColor="@android:color/white"
app:srcCompat="@drawable/ic_photo_camera" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_smlarge"
android:layout_marginLeft="@dimen/spacing_smlarge"
android:layout_marginRight="@dimen/spacing_smlarge"
android:layout_marginTop="@dimen/spacing_middle"
android:clickable="true"
android:tint="@android:color/white"
app:fabSize="normal"
app:rippleColor="@android:color/white"
app:srcCompat="@drawable/ic_add" />
<!--android:src="@drawable/ic_close_black_24dp"-->
</FrameLayout>
</LinearLayout>
我需要像这样放置fab bar。这是来自google的示例图像
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/app"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/bt_close"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:background="?attr/selectableItemBackgroundBorderless"
android:tint="@android:color/white"
app:srcCompat="@drawable/ic_close" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Filter All Order"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
android:textColor="@android:color/white" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_below="@id/app"
android:layout_above="@+id/fabFrame"
android:layout_height="match_parent"
android:scrollbars="none"
android:scrollingCache="true">
<LinearLayout
android:id="@+id/billBlock"
android:layout_width="match_parent"
android:layout_height="match_parent">
//many inner layout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/grey_10" />
<android.support.v7.widget.RecyclerView
android:id="@+id/print_payment_list"
android:layout_margin="10dp"
android:background="@color/grey_20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<FrameLayout
android:id="@+id/fabFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="?attr/actionBarSize"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_mic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_middle"
android:clickable="true"
android:tint="@color/grey_80"
app:backgroundTint="@color/grey_20"
app:fabSize="mini"
app:rippleColor="@android:color/white"
app:srcCompat="@drawable/ic_mic" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_middle"
android:clickable="true"
android:tint="@color/grey_80"
app:backgroundTint="@color/grey_20"
app:fabSize="mini"
app:rippleColor="@android:color/white"
app:srcCompat="@drawable/ic_photo_camera" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_smlarge"
android:layout_marginLeft="@dimen/spacing_smlarge"
android:layout_marginRight="@dimen/spacing_smlarge"
android:layout_marginTop="@dimen/spacing_middle"
android:clickable="true"
android:tint="@android:color/white"
app:fabSize="normal"
app:rippleColor="@android:color/white"
app:srcCompat="@drawable/ic_add" />
<!--android:src="@drawable/ic_close_black_24dp"-->
</FrameLayout>
</RelativeLayout>
//许多内部布局
在连续视图中始终使用线性布局,在显示位置(如右侧或底部)时使用框架布局或相对布局。您会显示屏幕截图和所需内容吗?@sushildlh.updated question.Thanksy您需要这样做吗?我需要在嵌套滚动视图中实现,因为我需要嵌套滚动视图,因为我是使用底部工作表视图如果我添加没有嵌套的fab bar,那么它works@sushildlh.thank您付出了这么多的努力。问题是,现在晶圆厂位于嵌套滚动视图下方,而不是滚动视图内部。您希望晶圆厂位于父布局的滚动视图底部吗?使用相对布局而不是线性布局。