2013-06-26 93 views
1

當edittext中的文本非常大時,是否可以在edittext視圖上使用水平滾動。並且還可以自動滾動到左側,顯示被隱藏的內容,當用戶輸入表單在android中自動滾動EditText內容

<EditText 
     android:id="@+id/rlMP3SeekContainer" 
     android:layout_width="0dp" 
     android:layout_height="40dp" 
     android:layout_weight="1" 
     android:background="@drawable/rectangle" 
     android:ems="10" 
     android:hint="@string/hint_deezer_search" 
     android:paddingLeft="@dimen/eight_dp" 
     android:paddingRight="@dimen/eight_dp" 
     android:textColor="@color/black" 
    android:textColorHint="sssssssssssosososskdddkdkdkdkdkddkowowowowwoeoekffkfkfkfkfkfkfkffkfkfkfkffkfkfkfkfoeeoeoeoeoeoeoeeoeoeoeoeoe" 
     android:textSize="@dimen/fourteen_sp" /> 

回答

3

是的,有可能與以下幾行:

android:singleLine="true" 
android:scrollHorizontally="true" 

然後,文字要輸入將向左移動並將在單行中。

+0

將自動滾動? – Dimitri

+0

是的。它將在輸入時自動滾動。編輯你的xml並檢查 –

+0

它不滾動 – Dimitri

1

嘗試添加

android:lines="1" 
android:scrollHorizontally="true" 
android:ellipsize="end" 

這樣

<EditText 
     android:id="@+id/rlMP3SeekContainer" 
     android:layout_width="0dp" 
     android:layout_height="40dp" 
     android:layout_weight="1" 
     android:background="@drawable/rectangle" 
     android:ems="10" 
     android:hint="@string/hint_deezer_search" 
     android:paddingLeft="@dimen/eight_dp" 
     android:paddingRight="@dimen/eight_dp" 
     android:textColor="@color/black" 
    android:textColorHint="sssssssssssosososskdddkdkdkdkdkddkowowowowwoeoekffkfkfkfkfkfkfkffkfkfkfkffkfkfkfkfoeeoeoeoeoeoeoeeoeoeoeoeoe" 
     android:textSize="@dimen/fourteen_sp" 
android:lines="1" 
    android:scrollHorizontally="true" 
    android:ellipsize="end" 
/> 
+0

感謝十字軍,但它不是水平滾動 – Dimitri

+0

我認爲它會滾動選擇你的編輯文本 – CRUSADER

0

你可以用下面雙擊自動滾屏下來的時候你正在寫

android:isScrollContainer="true"