私は私のを持っていますlayout
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
>
<ImageView
android:id="@+id/id_new_big_list_item_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_centerHorizontal="true" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical"
android:background="@drawable/round_corners_new_bottom" >
<TextView
android:id="@+id/id_new_big_list_item_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textColor="@color/new_restaurant_name"
android:paddingTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp" />
</LinearLayout>
</LinearLayout>
テキストビューを使用して、線形レイアウトの上部(中央の水平)と下部に画像を表示する必要があります。画像の幅は異なる場合がありますが、線形レイアウトの幅を画像と同じに設定したいと思います。ただし、テキストが長すぎると、幅が広くなります。どうやってやるの?テキストの幅が画像の幅よりも大きい場合は、2行のテキストを作成します。
出来ますか??
ここに私のレイアウトのスナップ: