gpt4 book ai didi

android - CoordinatorLayout 使 View 未定位

转载 作者:行者123 更新时间:2023-11-29 15:34:10 25 4
gpt4 key购买 nike

抱歉我的英语不好。我试图使用 Coordinatorlayout 制作带有 recyclerview 的滚动工具栏。滚动工作正常,但 View 位于工具栏下方,如滑动刷新布局显示在 screenshot 中.Activity_main.xml我在 FrameLayout mobile_container

中实现一个 fragment
<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.naveed.youtubepro.activity.MainActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:title="@string/app_name">
</android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/mobile_container"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent">

</FrameLayout>
<me.majiajie.pagerbottomtabstrip.PageNavigationView
android:id="@+id/navigation"
android:elevation="8dp"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:background="#FFF"
app:menu="@menu/bottom_navigation_items"/>

</LinearLayout>

</android.support.design.widget.CoordinatorLayout >

fragment 布局

<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainandroid.support.v4.widget.SwipeRefreshLayout">
<com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recyclerViee"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>

最佳答案

像这样做。希望这有效。

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:id="@+id/txt_forget_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:title="@string/app_name">
</android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/mobile_container"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">

</FrameLayout>
<me.majiajie.pagerbottomtabstrip.PageNavigationView
android:id="@+id/navigation"
android:elevation="8dp"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="#FFF"
app:menu="@menu/bottom_navigation_items"/>

</LinearLayout>

</LinearLayout>



</android.support.design.widget.CoordinatorLayout >

关于android - CoordinatorLayout 使 View 未定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55492202/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com