簡體   English   中英

在android studio中沒有android:layout_below

[英]there is no android:layout_below in android studio

我正在嘗試在我的LinearLayout下方放置一個recyclerview,但是recyclerview沒有android:layout_below選項! 然后我嘗試將我的recyclerview放入LinearLayout並為布局設置layout_below,但是linearlayout也不存在layout_below!

抱歉,我的英語不好,但是無論如何...這是我的XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="tablo.mirshekari.customers.StoreFragment">

<LinearLayout
    android:id="@+id/store_view"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:gravity="right"
    android:paddingRight="20dp"
    android:paddingTop="20dp"
    android:background="@color/cardview_dark_background"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:gravity="right"
        android:paddingTop="10dp"
        android:background="@color/cardview_dark_background"
        android:orientation="horizontal">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:text="lasjdbkajbd"
        android:textColor="@color/white"
        android:paddingRight="10dp"
        android:layout_gravity="right"
        android:gravity="right|center_vertical"
        android:id="@+id/store_name" />
    <ImageView
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:src="@drawable/ic2w"
        android:layout_gravity="right"
        />

</LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:gravity="right"
        android:background="@color/cardview_dark_background"
        android:orientation="horizontal">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:text="lasjdbkajbd"
            android:textColor="@color/white"
            android:paddingRight="10dp"
            android:layout_gravity="right"
            android:gravity="right|center_vertical"
            android:id="@+id/store_textposition" />
        <ImageView
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/address_white"
            android:layout_gravity="right"
            />

    </LinearLayout>

</LinearLayout>

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ></android.support.v7.widget.RecyclerView>
</FrameLayout>

據我所知, layout_below僅可用於RelativeLayout 請參見RelativeLayout.LayoutParamsLinearLayout.LayoutParams

這意味着,必須將視圖放入RelativeLayout中才能使用該屬性。

UPDATE

是的,您正在將視圖放入FrameLayout 考慮將其更改為垂直方向的LinearLayout ,或將RelativeLayoutlayout_below用於RecyclerView

線性布局不包含 android: layout_below選項。 因此,您可以使用相對布局代替線性布局來使用android:layout_below選項。

暫無
暫無

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

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