我有一个MainActivity与导航抽屉。我为每个项目创建一个片段在我的导航器抽屉中。我有一个包含在我的content.xml中的toolbar.xml,我想将我的content.xml设置为我的片段的默认布局。但我想让它滚动,因为我的一些片段有很多文字&图片! 我在片段布局的Relativelayout中使用Scrollview,但它不起作用。使fragment_layout可滚动
这是我的content.xml中,我想将其设置为我的片段默认布局:
<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:id="@+id/layout_for_fragment"
android:layout_height="match_parent"
android:background="#132740">
<include layout="@layout/toolbar" />
</RelativeLayout>
,这是我IntroFragment.xml:
<RelativeLayout 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"
android:background="@color/colorPrimary"
tools:context="com.example.arsh.enc.IntroFragment">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="@+id/introfragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:lineSpacingExtra="10sp"
android:text="VERY VERY
VERY VERY
VERY VERY
VERY VERY
VERY VERY LONG TEXT"
android:textColor="#FFFFFF" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
正如我所说,我使用ScrollView,但没有结果。谁能告诉我我哪里出错了?我该怎么做才能解决我的问题。
你是对的就已经是滚动的,但没有必要使用的ListView – godot