簡體   English   中英

FrameLayout 在 android 布局中的工作原理

[英]How FrameLayout works in android layout

在此處輸入圖像描述

我正在嘗試實現上述設計,但使用框架布局,藍色圖像未顯示在白色背景上方。 哪里錯了,求大神幫忙?

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/adapter_flParent"
    android:orientation="vertical">


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:background="@drawable/bg_edit_text"
    android:elevation="5dp"
    android:translationZ="1dp"
    android:layout_margin="10dp"
    android:padding="10dp">

    <TextView
        android:id="@+id/adapter_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="6dp"
        android:layout_marginEnd="10dp"
        android:text="Regional Snooker" />
    <TextView
        android:id="@+id/adapter_org"
        android:layout_below="@+id/adapter_Title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="6dp"
        android:layout_marginEnd="10dp"
        android:text="Concered Authority"/>

</RelativeLayout>


    <ImageView
        android:layout_width="100dp"
        android:layout_height="60dp"
        android:layout_margin="10dp"
        android:layout_gravity="right"
        android:background="@drawable/adapter_blue" />
    <TextView
        android:id="@+id/adapter_data"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="6dp"
        android:layout_marginEnd="10dp"
        android:gravity="right|center"
        android:layout_gravity="right|center"
        android:text="PASSED"/>
</FrameLayout>

我正在嘗試獲取藍色圖像,但無法使用框架布局在白色背景上方獲取此藍色圖像,並且還必須在藍色圖像上方添加愛情圖像。

    <?xml version="1.0" encoding="utf-8"?>

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/adapter_flParent"
    android:elevation="@dimen/ten_dp"
    android:orientation="vertical"
    android:layout_margin="10dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="@drawable/white_corner_radius_background"
            android:elevation="5dp"
            android:weightSum="1"
           android:orientation="horizontal"
            android:layout_marginBottom="20dp">


            <LinearLayout
                android:layout_weight="0.75"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:gravity="center_vertical">

                <TextView
                    android:id="@+id/adapter_Title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingStart="@dimen/ten_dp"
                    android:paddingEnd="@dimen/ten_dp"
                    android:text="Regional Snooker"
                    />

                <TextView
                    android:id="@+id/adapter_org"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingStart="@dimen/ten_dp"
                    android:paddingEnd="@dimen/ten_dp"
                    android:text="Concered Authority"/>

            </LinearLayout>

            
            <TextView
                android:id="@+id/adapter_data"
                android:layout_weight="0.25"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:gravity="center"
                android:textColor="@color/white"
                android:background="@drawable/test_blue_bg"
                android:layout_gravity="right|center"
                android:text="PASSED"/>

        </LinearLayout>

        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginEnd="@dimen/ten_dp"
            android:layout_gravity="end|bottom"
            android:elevation="10dp"
            android:background="@drawable/ic_round_favorite_unfilled" />

    </FrameLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM