我正尝试用两个视图填充活动,左侧为ImageView
,右侧为TextView
。图像的大小应该填满整个垂直空间。文本应该占用剩下的空间。看了几个教程后,似乎我需要的是一个水平方向的LinearLayout
,并且TextView
的layout_weight
属性是一个正整数。Android布局;图片占用整个屏幕
这是我到目前为止有:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/charsheet" />
<TextView
android:id="@+id/ipsum"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/ipsum" />
</LinearLayout>
的问题,但是,图像,创建空白到填满整个屏幕的左侧和右侧。 TextView
没有剩余空间。
我也尝试使用RelativeLayout
与ImageView
的toStartOf
属性设置为TextView
的ID,但随后的文字填满整个屏幕来代替。
当我开始进行这项活动时,我不会认为这会是一件很复杂的事情,但我们在这里。任何帮助,将不胜感激。
你想要的形象被裁剪,以适应或调整大小以适应? –
调整大小,我想。我想看到整个图像,只是减去正在添加的空白空间 –