【发布时间】:2018-01-24 06:12:31
【问题描述】:
我在主屏幕上有一个CardView 设置(带有RecyclerView)。所以当我尝试通过我的NavigationDrawer 并切换到不同的Fragment 时,CardView 会显示在它上面(是的,我使用了回收站视图
有人可以帮忙吗?
添加了包含卡片视图的项目布局(xDDD 更多详细信息)
Activity_main.xml
<android.support.v4.widget.DrawerLayout 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/dl"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.wallpaperstore.thelastofuswallpapersandwalkthrough.MainActivity">
<FrameLayout
android:background="@color/white"
android:id="@+id/flcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</FrameLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
</android.support.v7.widget.RecyclerView>
<android.support.design.widget.NavigationView
app:headerLayout="@layout/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/Navigation_v"
app:menu="@menu/nav_menu"
android:layout_gravity="start" >
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
fragment_walkthrough.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.wallpaperstore.thelastofuswallpapersandwalkthrough.Walkthrough">
<!-- TODO: Update blank fragment layout -->
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
项目布局
<android.support.v7.widget.CardView
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="wrap_content"
android:layout_margin="10dp"
app:cardElevation="10dp">
<com.battleent.ribbonviews.RibbonLayout
android:id="@+id/ribbonLayout"
android:layout_width="match_parent"
android:layout_height="210dp"
app:bottom_ribbonColor="#FFFFFF"
app:bottom_textColor="@android:color/white">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
<Button
android:id="@+id/button9"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Set Wallpaper"
android:textColor="@color/darkgray"
tools:text="@string/bottom_sheet_behavior" />
</com.battleent.ribbonviews.RibbonLayout>
</android.support.v7.widget.CardView>
【问题讨论】:
-
你的代码真的有效吗?抽屉布局只接受两个孩子,您已将三个孩子添加到抽屉布局。请参阅文档。 developer.android.com/training/implementing-navigation/…
-
现在该怎么办?
-
我不希望卡片视图出现在演练片段中
-
你想在哪里显示回收站视图??
-
在主Activity上(应用启动时的启动屏幕)
标签: android android-layout android-fragments android-recyclerview android-cardview