Android текстовое представление перекрывается - PullRequest
0 голосов
/ 03 января 2012

В моем приложении для Android есть следующий составной вид

enter image description here

Как видите, прямо над текстовым представлением внизу есть число.Это число указывает текущую длину текста.

Я просто не могу понять, как поставить число на правой стороне.Другая проблема заключается в том, что когда текстовое поле расширяется, оно скрывает индикатор длины.Таким образом, серый слой выходит за число.

<RelativeLayout
        xmlns:a="http://schemas.android.com/apk/res/android"
        a:layout_width="fill_parent"
        a:layout_height="fill_parent"
        a:background="#ffffff" >

        <LinearLayout
            a:layout_width="fill_parent"
            a:layout_height="wrap_content"
            a:orientation="horizontal"
            a:paddingBottom="5dip"
            a:paddingLeft="5dip"
            a:paddingRight="5dip"
            a:paddingTop="5dip" >

            <MultiAutoCompleteTextView
                a:id="@+id/recipientBody"
                a:layout_width="0dip"
                a:layout_height="wrap_content"
                a:layout_weight="1.0"
                a:hint="@string/sms_to_whom"
                a:maxLines="10"
                a:nextFocusRight="@+id/smsRecipientButton" />

            <LinearLayout
                a:layout_width="wrap_content"
                a:layout_height="fill_parent"
                a:orientation="vertical" >

                <Button
                    a:id="@+id/smsRecipientButton"
                    a:layout_width="wrap_content"
                    a:layout_height="0dip"
                    a:layout_marginLeft="5dip"
                    a:layout_weight="1.0"
                    a:enabled="true"
                    a:nextFocusLeft="@+id/recipientBody"
                    a:onClick="onPickContact"
                    a:text="@string/sms_contacts" />
            </LinearLayout>
        </LinearLayout>
        //************ 
        <LinearLayout
            a:layout_width="wrap_content"
            a:layout_height="fill_parent"
            a:layout_marginBottom="65dip"
            a:layout_marginLeft="10dip"
            a:gravity="bottom"
            a:orientation="vertical" >

            <TextView
                android:id="@+id/chars"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="" />
        </LinearLayout>
          //************ 
        <LinearLayout
            a:layout_width="fill_parent"
            a:layout_height="wrap_content"
            a:layout_alignParentBottom="true"
            a:background="#9c9e9c"
            a:orientation="horizontal"
            a:paddingBottom="5dip"
            a:paddingLeft="5dip"
            a:paddingRight="5dip"
            a:paddingTop="5dip" >

            <EditText
                a:id="@+id/smsBody"
                a:layout_width="0dip"
                a:layout_height="wrap_content"
                a:layout_weight="1.0"
                a:autoText="true"
                a:capitalize="sentences"
                a:hint="@string/sms_enter_message"
                a:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
                a:nextFocusRight="@+id/send_button" />

            <LinearLayout
                a:layout_width="wrap_content"
                a:layout_height="fill_parent"
                a:orientation="vertical" >

                <Button
                    a:id="@+id/smsSendButton"
                    a:layout_width="wrap_content"
                    a:layout_height="0dip"
                    a:layout_marginLeft="5dip"
                    a:layout_weight="1.0"
                    a:enabled="false"
                    a:nextFocusLeft="@+id/smsBody"
                    a:text="@string/sms_send_abbr" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>

Я пометил индикатор //************.Что мне нужно изменить в этом файле макета, чтобы поместить индикатор справа и избежать наложения?

Ответы [ 2 ]

1 голос
/ 23 июня 2012

Или вы можете использовать LinearLayout и использовать два textview, один из которых пуст и дать ему layoutweight=1.

1 голос
/ 03 января 2012

Сначала дайте идентификатор нижнему значению LinearLayout.

Затем добавьте:

a:layout_above="@+id/lowerLinearLayout" a:layout_alignParentRight="true"

в определение LinearLayout для представления вашего индикатора.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...