0

LinearLayout に複数行の TextView を追加したいと考えています。以下は私のコードですが、機能していません。デバイスでは、1 行だけが表示されます。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="right"
  android:orientation="horizontal">
  <ImageView
     android:id="@+id/file_picker_image"
     android:layout_width="40dip"
     android:layout_height="40dip"
     android:layout_marginTop="10dip"
     android:layout_marginBottom="5dip"
     android:layout_marginLeft="5dip"
     android:src="@drawable/file"
     android:scaleType="centerCrop"/>

  <TextView
     android:id="@+id/file_picker_text"
     android:layout_width="fill_parent"
     android:layout_height="60dip"
     android:layout_weight="1"
     android:layout_gravity="left|center_vertical"
     android:textSize="18sp"
     android:layout_marginLeft="10dip"
     android:layout_marginRight="10dip"
     android:layout_marginTop="10dip"
     android:singleLine="false" 
     android:maxLines="2"
     android:lines="2"
     android:text="Multiline text here"/>

</LinearLayout>
4

1 に答える 1

0

私にとってはうまくいきました。次のようにテキストにさらに文字を入れてみてください。

android:text="Multiline text here with more characters uhuuuuu"
于 2013-05-16T19:48:45.747 に答える