Java 为什么我不能在片段中滚动文本视图?
我已经尝试过使用解决方案rom Rigth现在它是一个滚动视图。 这两种可能性都不允许我滚动文本 它是minSDK的第8版。它还必须能够在安卓2.2.1上运行 我还在build.gradle中包含了以下支持库Java 为什么我不能在片段中滚动文本视图?,java,android,listview,android-fragments,Java,Android,Listview,Android Fragments,我已经尝试过使用解决方案rom Rigth现在它是一个滚动视图。 这两种可能性都不允许我滚动文本 它是minSDK的第8版。它还必须能够在安卓2.2.1上运行 我还在build.gradle中包含了以下支持库 compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile 'com.android.support:support-v4:23.4.0' My
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:support-v4:23.4.0'
My FragmentOne.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView
android:id="@+id/ScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="lorem ipsum .. (500 Words)"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/tvStatus"/>
由于您在TextView中没有足够的内容,或者在scrollview中添加了足够的视图,经过几天的搜索,我终于在文件中找到了错误 在app_bar_main.xml中,您必须确保您的include/layout位于
下方。在任何其他情况下,您都会遇到与我相同的问题
app_bar_main.xml
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".TemplateActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/AppTheme.PopupOverlay">
<LinearLayout
android:id="@+id/main_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/main_toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/fragment_one"/>
</android.support.design.widget.CoordinatorLayout>
在这里,它似乎不应该是:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".TemplateActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/AppTheme.PopupOverlay">
<LinearLayout
android:id="@+id/main_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/main_toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<include layout="@layout/fragment_one"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
我刚刚剪切了TextView中的内容。我认为发布两个lorem ipsum网站不是最好的主意。因此TextView甚至比我的S7上的屏幕还要长。该应用程序将以最大VGA分辨率运行。这就是为什么我在这里问,即使它足够大,它也不会滚动
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".TemplateActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/AppTheme.PopupOverlay">
<LinearLayout
android:id="@+id/main_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/main_toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<include layout="@layout/fragment_one"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>