小编Son*_*mar的帖子

如何在两个布局之间放置一个按钮

我想在两个布局之间放置一个普通按钮,如图所示.

我不想使用浮动按钮和协调器布局.

是否有可能通过相对布局?

演示图像 没有图像描述

我正在使用以下xml文件来执行此操作.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="10" >

    <fragment
        android:id="@+id/mapForPlannedRide"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="3.5" />

    <LinearLayout
        android:id="@+id/planned_detail_layout"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="6.5"
        android:background="@color/text_white"
        android:orientation="vertical"
        android:weightSum="10" >

        <LinearLayout
            android:id="@+id/departure_layout"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="2.5"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="20dp"
            android:paddingRight="20dp" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/passenger" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingLeft="5dp" >

                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/departure"
                    android:textSize="@dimen/text_size17sp" />

                <TextView
                    android:id="@+id/departure"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="dfg ddfghd dfdg"
                    android:textSize="@dimen/text_size14sp" />
            </LinearLayout>
        </LinearLayout>

        <View
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight=".03"
            android:background="@color/line_color" />

        <LinearLayout
            android:id="@+id/destination_layout"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="2.5"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="20dp" …
Run Code Online (Sandbox Code Playgroud)

xml android android-layout android-imageview android-studio

6
推荐指数
1
解决办法
731
查看次数