Android 在滚动大文本时,如何防止ActionBar离开屏幕?
我有这个Android 在滚动大文本时,如何防止ActionBar离开屏幕?,android,android-actionbar,android-support-library,Android,Android Actionbar,Android Support Library,我有这个EditText: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <EditText android:id="@+id/text_editor" android:
EditText
:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/text_editor"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="start|top"
android:inputType="textLongMessage|textCapSentences|textMultiLine"
android:textAlignment="gravity" />
</RelativeLayout>
我正在使用supportActionBarActivity
,这就是我在Nexus 5上的功能:
如您所见,ActionBar
在屏幕上略微滚动。我已经证明了这一点
我认为这不是预期的行为,是吗?如果是,我该如何防止这种情况?这似乎很不直观。将您的
编辑文本
包装在滚动视图
中
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/text_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start|top"
android:inputType="textLongMessage|textCapSentences|textMultiLine"
android:textAlignment="gravity" />
</ScrollView>
只需在actionbar的xml中删除此属性:
app:layout\u scrollFlags=“scroll | enterally”我不确定可滚动视图在
滚动视图中是否能正常播放,但我会尝试一下,谢谢。@BenoitDuffez添加了一个视频。