[英]Android place an image view between two views
I need to create a layout as shown in the image.我需要创建如图所示的布局。 The rounded button with the arrow needs to be exactly between the blue and the gray background.带有箭头的圆形按钮需要恰好位于蓝色和灰色背景之间。 I'm having difficulties placing it without specifying the margins precisely, which is something I don't want to do because there is no guarantee it will look good on all resolutions and devices.如果不精确指定边距,我很难放置它,这是我不想做的事情,因为不能保证它在所有分辨率和设备上看起来都很好。 I would appreciate an xml sample for that我将不胜感激 xml 样本
Thanks!谢谢!
Use the desired drawable.. hope it works.. you can set width and height according to your need.使用所需的 drawable.. 希望它有效.. 您可以根据需要设置宽度和高度。
<?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="match_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#1b96d9"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#e6e6e6"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/arrow" />
</FrameLayout>
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.