代码之家  ›  专栏  ›  技术社区  ›  Dr4ke the b4dass

如何使一个按钮浮在布局像一个晶圆厂,或使一个晶圆厂与双按钮?

  •  0
  • Dr4ke the b4dass  · 技术社区  · 7 年前

    enter image description here

    底部的按钮,Map/filter。来自expedia应用程序。这是什么纽扣?一个晶圆厂可以被改写为有两个按钮吗?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Ben P.    7 年前

    我猜,作为一个 极其

    您可以使用 FrameLayout (或精神亚类) CoordinatorLayout )来主持你的主要内容视图,然后你的“按钮”视图组在上面。 CardView 是在所有Android API级别上获得圆角和提升的好方法:

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <!-- insert your content here -->
    
        <android.support.v7.widget.CardView
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:layout_marginBottom="32dp"
            android:layout_gravity="center_horizontal|bottom"
            app:cardCornerRadius="24dp"
            app:cardElevation="8dp">
    
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:paddingLeft="12dp"
                android:paddingRight="12dp"
                android:orientation="horizontal">
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:padding="12dp"
                    android:gravity="center"
                    android:drawableStart="@drawable/icon_map"
                    android:drawablePadding="6dp"
                    android:textColor="#00f"
                    android:textSize="18sp"
                    android:text="@string/label_map"
                    android:fontFamily="sans-serif-medium"/>
    
                <View
                    android:layout_width="1dp"
                    android:layout_height="match_parent"
                    android:layout_marginTop="12dp"
                    android:layout_marginBottom="12dp"
                    android:background="#ccc"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:padding="12dp"
                    android:gravity="center"
                    android:drawableStart="@drawable/icon_filters"
                    android:drawablePadding="6dp"
                    android:textColor="#00f"
                    android:textSize="18sp"
                    android:text="@string/label_filters"
                    android:fontFamily="sans-serif-medium"/>
    
            </LinearLayout>
    
        </android.support.v7.widget.CardView>
    
    </FrameLayout>
    

    enter image description here