2017-01-14 82 views
1

android:gravity="right" 私は右に自分のテキストを配置するように設定しました。 ただし、文字列の長さがスペースを超えると、次のテキストは表示されません。Androidスタジオのヘルプが必要です:テキストの整列

これを解決するにはどうすれば前のエントリが左に移動するのですか?

私のコードの問題はEditText.append()です.NextClickListenerから新しい入力を追加すると、テキストはキーボード入力と同じように動作します。

あなたは私にそれを解決する方法を教えてもらえますか?申し訳ありませんが、私は、Android

<EditText 
    android:id="@+id/equation" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginEnd="16dp" 
    android:layout_marginLeft="16dp" 
    android:layout_marginRight="16dp" 
    android:layout_marginStart="16dp" 
    android:layout_marginTop="40dp" 
    android:ems="10" 
    android:focusable="false" 
    android:focusableInTouchMode="false" 
    android:inputType="numberSigned|numberDecimal" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    android:clickable="false" 
    android:gravity="right" 
    android:layout_gravity="end"/> 

//画像

編集テキストウィジェットが右揃えされるに新しいです。

文字列の長さがスペースを超えた場合、新しいエントリを見ることができません。

古いエントリが左に移動し、新しいエントリが編集テキストウィジェットの右端に表示されるように変更するにはどうすればよいですか?

+0

は、あなたのXMLが –

答えて

4

はちょうどこのプロパティは、すべてのAndroidのバージョンをサポートし、あなたののEditText

android:layout_alignParentRight="true" 

にこのプロパティを追加します。でも@pail kantiでもOKでもandroid:textDirection="anyRtl" APIレベル17以上

ありがとうございます。

+0

OnClickListenerから新しい入力を追加すると、自分のコードの問題は 'EditText.append()'から発生しているようですが、テキストはキーボード入力と同じように動作します。 解決方法を教えてください。申し訳ありませんが、Androidの新機能です – KuKKi

+0

@KuKKi上記のコードはあなたのために働いているのですか? –

+0

私はエミュレータのキーボードを使って入力してもうまくいきました。しかし、テキストがappend()メソッドを使用して追加された場合ではありません。 – KuKKi

1

ちょうどあなたののEditTextにこれを追加します。

android:textDirection="anyRtl" 

これはあなたの問題を解決します。

+0

新しいエントリはこの2行を削除し、このライン – KuKKi

+0

を追加した後に目に見える宇宙の外にはまだですしてください示して android:focusableInTouchMode = "false" ' 鉱山が機能しています。 –

+0

私の間違い** minSdkVersion **は17以上である必要があります。 ** build.gradle **を確認してください。 –

1

はこれを試してみてください。 `アンドロイド::=「false」にフォーカス可能

<EditText 
     android:id="@+id/equation" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:maxLines="1" 
     android:scrollHorizontally="true" 
     android:ellipsize="end" 
     android:layout_marginEnd="16dp" 
     android:layout_marginLeft="16dp" 
     android:layout_marginRight="16dp" 
     android:layout_marginStart="16dp" 
     android:layout_marginTop="40dp" 
     android:ems="10" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:inputType="numberSigned|numberDecimal" 
     android:clickable="false" 
     android:gravity="right"> 
    </EditText> 
+0

私のコードの問題は、EditText.append() OnClickListenerから新しい入力を追加すると、テキストはキーボード入力と同じように動作します。 解決方法を教えてください。申し訳ありません、Androidには初めてです – KuKKi

0
android:inputType="....|textMultiLine" 
関連する問題