1

テキストビューとボタンがあり、テキストビューのテキストが長い文でいっぱいになると、ボタンの背景がいっぱいになります。修正するにはどうすればよいですか?

ここに画像の説明を入力

テキストビューは「dosyaAdi」、ボタンは「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" />

そしてこれのために:

左が「txtKonu」、右が「txtSaat」

ここに画像の説明を入力

4

3 に答える 3

2

android:layout_toLeftOf="@id/buttonEkIndir問題のあるdosyaAdiに追加できます。

ただし、それは、テキストがボタンの下にある場合でも、ボタンの左側に留まるということを意味します(これがあなたにとって重要かどうかはわかりませんが、私が言及したいと思います)。

編集

そして2番目のものはandroid:layout_toLeftOf="@id/txtSaattxtKonuに追加します。

于 2012-05-23T14:35:29.317 に答える
2

他の人からのレイアウト調整ソリューションに加えて、TextViewに次を設定する必要があると思います。このような長いファイル名を表示するのはかなり役に立たないからです:)

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

を見てくださいandroid:layout_toLeftOf。オーバーフローしているテキストビューにそれを追加し、ボタンビューと同じに設定する必要があると思います。そのTextViewをボタンの左側に配置する必要があります。

于 2012-05-23T14:35:37.217 に答える