我有这个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>
我正在使用支持 ActionBarActivity
,这就是我在 Nexus 5 上拥有的功能:
如您所见,ActionBar
稍微滚动到屏幕之外。我做了a video这表明了这一点。
我认为这不是预期的行为,是吗?
如果是的话,我该如何防止这种情况发生?这似乎非常违反直觉。
最佳答案
将 EditText
包裹在 ScrollView
中。
<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>
关于android - 当滚动大的 EditText 时,如何防止 ActionBar 超出屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22466848/