質問

I've got this 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>

I'm using the support ActionBarActivity, and this is what I have on my Nexus 5:

Half out of screen ActionBar

As you can see the ActionBar is slightly scrolled off screen. I've made a video that shows that.

I don't think this is the expected behavior, is it?
If it is, how can I prevent this? It seems very counter-intuitive.

役に立ちましたか?

解決

Wrap your EditText in a 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>

他のヒント

Just remove this attribute in your actionbar's xml:

app:layout_scrollFlags="scroll|enterAlways"

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top