Che*_*tna 2 android textview android-layout android-imageview
我的XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/signOut"
android:layout_centerInParent="true"
android:layout_marginLeft="10dip"
/>
<TextView
android:id="@+id/gridtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageMenu"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:layout_centerHorizontal="true"
android:text="TextView"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我可以在此网格布局中将图像设置在图像的正下方,但是如果文本太大,我还希望将文本包装到下一行.例如,我有一个"血库"的图像,文字是"最近的血库".我希望它包含在图像的宽度内.怎么做?
试试这个.
<TextView
android:id="@+id/gridtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/imageMenu"
android:layout_alignLeft="@+id/imageMenu"
android:layout_below="@+id/imageMenu"
android:layout_marginTop="10dip"
android:text="TextView"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000"
android:singleLine="false" />
Run Code Online (Sandbox Code Playgroud)