如何在Android应用程序中添加滚动条到编辑文本?

时间:2015-03-07 18:19:33

标签: android

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/etName"
        android:layout_marginTop="20dp"
        android:hint="Your Name"
        android:scrollbars="vertical"            
        />
</ScrollView>

这是我试图做的,但不能正常工作,这是做正确的方法吗?

1 个答案:

答案 0 :(得分:1)

我试试这个,滚动作品

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/etName"
    android:layout_marginTop="20dp"
    android:text="qweqwew\n fddfd"
    android:maxLines="1"
    android:hint="Your Name"
    android:scrollbars="vertical"            
    />
相关问题