在Android中,我试图使用xml来获得类似this image的布局。
我一直试图将视图垂直分成两部分。一个用于蓝色部分,一个用于白色。对于蓝色部分,我使用形状作为背景来获得渐变,而白色部分则使用白色背景。它适用于“标题”和“某些文本”部分。但是,由于图像视图应覆盖两个布局,因此无法正常工作。
我无法弄清楚如何设置xml布局以使其正常运行?
答案 0 :(得分:1)
我会这样做:
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_alignParentTop="true"
android:text="title"
/>
<TextView
android:layout_below="@id/title"
android:layout_alignParentBottom="true"
android:text="some text here"
/>
<ImageView
android:layout_alignParentLeft="true"
android:text="title"
/>
</RelativeLayout>
当然,您需要在这些元素上设置布局宽度,高度......。
答案 1 :(得分:0)
我认为你会在这里找到答案:set the absolute position of a view in Android