1

I have a textview and a button and when my textview's text is filling with a long sentence it is filling background of my button. What should I do to fix it ?

enter image description here

Textview is "dosyaAdi", button is "buttonEkIndir"

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.03"
    android:background="#ededed" >

    <TextView
        android:id="@+id/txtKimden"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@android:color/black"
        android:textSize="20dp" />

    <TextView
        android:id="@+id/txtKonu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/txtKimden"
        android:layout_marginLeft="10dp"
        android:text="Small Text"
        android:ellipsize="end"
        android:maxLines="3"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@android:color/black"
        android:textSize="17dp" />

    <ImageView
        android:id="@+id/imageViewAttachment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/txtKonu"
        android:layout_marginLeft="10dp"
        android:src="@drawable/ic_email_attachment65x30" />

    <TextView
        android:id="@+id/dosyaAdi"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageViewAttachment"
        android:layout_toRightOf="@+id/imageViewAttachment"

        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@android:color/black"
        android:textSize="17dp" />

    <TextView
        android:id="@+id/txtTarih"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/txtKimden"
        android:layout_alignBottom="@+id/txtKimden"
        android:layout_alignParentRight="true"
        android:layout_marginRight="10dp"
        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@android:color/black"
        android:textSize="15dp" />

    <TextView
        android:id="@+id/txtSaat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/txtTarih"
        android:layout_below="@+id/txtTarih"
        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@android:color/black"
        android:textSize="15dp" />

    <Button
        android:id="@+id/buttonEkIndir"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="70dip"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/dosyaAdi"
        android:layout_alignBottom="@+id/dosyaAdi"
        android:layout_alignLeft="@+id/txtSaat"
        android:text="İndir" />

</RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ededed" >
</RelativeLayout>

<WebView
    android:id="@+id/webvGovde"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1" />

and for this one :

"txtKonu" is left one , "txtSaat" is right one

enter image description here

4

3 回答 3

2

You could add android:layout_toLeftOf="@id/buttonEkIndir to the offending dosyaAdi.

However, that will mean the text stays to the left of the button even when it goes below it (not sure if this is important to you, just thought I'd mention it).

EDIT

And for the second one add android:layout_toLeftOf="@id/txtSaat to txtKonu.

于 2012-05-23T14:35:29.317 回答
2

Besides layout adjustment solution from others, I think you should also set the following to your TextView because its pretty useless to show such a long file-name :)

android:ellipsize="end"
android:singleLine="true"
于 2012-05-23T14:37:05.357 回答
1

Look at android:layout_toLeftOf. I believe you need to add that to the text view that is overflowing and set it equal to your button view. You want that TextView to be to the Left of the button.

于 2012-05-23T14:35:37.217 回答