Android 安卓<;在NestedScrollView中包含布局
我已与NestedScrollview协调布局。我试图将布局包含在nestedScrollView中,但是,该布局假定它可以与折叠工具栏重叠。我到处找,找不到解决这个问题的办法。我还尝试直接包含片段而不是布局。这也失败了。我还尝试在NestedScrollView中包含一个简单的TextView——它起作用了。因此,问题显然在“包含”中。请帮我解决它 不起作用Android 安卓<;在NestedScrollView中包含布局,android,android-fragments,android-coordinatorlayout,Android,Android Fragments,Android Coordinatorlayout,我已与NestedScrollview协调布局。我试图将布局包含在nestedScrollView中,但是,该布局假定它可以与折叠工具栏重叠。我到处找,找不到解决这个问题的办法。我还尝试直接包含片段而不是布局。这也失败了。我还尝试在NestedScrollView中包含一个简单的TextView——它起作用了。因此,问题显然在“包含”中。请帮我解决它 不起作用 <android.support.v4.widget.NestedScrollView android:id="@+
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/content_detail"/>
</android.support.v4.widget.NestedScrollView>
是的,如果选择BasicActivity,将自动生成此类布局和代码。
您可以在/res/layout/content\u detail
中设置文本(内容),而不是在MainActivity的布局中设置文本。是否尝试将包含嵌套在布局中?简单的线性布局可能会解决它…@Dieglock不,它没有帮助,我尝试了线性、相对甚至框架…不解决问题你能发布整个xml吗?@vrundpurohit我添加了一个完整的布局文件是的,我知道它会自动生成。对不起,我不明白你对解决方案的建议。你能解释一下吗。
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a working text"/>
</android.support.v4.widget.NestedScrollView>
<?xml version="1.0" encoding="utf-8"?>
<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/detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jennyeckstein.udacitycoursepicker.DetailActivity"
android:background="#d82a2a">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#292c65">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleMarginStart="50dp"
android:background="#78df49">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"
app:contentInsetStart="50dp"
android:background="#2cb27c">
<ImageView
android:id="@+id/detail_course_image_appBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="@drawable/course_test_image"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|enterAlways"
/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/scrim"/>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
android:background="@color/colorAccent"
>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!--<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a working text"/>-->
<include layout="@layout/content_detail"
/>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>