[英]there is no android:layout_below in android studio
I'm trying to put a recyclerview below my LinearLayout but there was no android:layout_below option for the recyclerview! 我正在尝试在我的LinearLayout下方放置一个recyclerview,但是recyclerview没有android:layout_below选项! then i tried to put my recyclerview into a LinearLayout and set layout_below for the layout but there was no layout_below for linearlayout either! 然后我尝试将我的recyclerview放入LinearLayout并为布局设置layout_below,但是linearlayout也不存在layout_below!
I'm sorry i'm not good at english but anyway ... here is my XML: 抱歉,我的英语不好,但是无论如何...这是我的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>
As far as I know, layout_below
is only available for RelativeLayout
. 据我所知, layout_below
仅可用于RelativeLayout
。 See RelativeLayout.LayoutParams
and LinearLayout.LayoutParams
. 请参见RelativeLayout.LayoutParams
和LinearLayout.LayoutParams
。
This means, you must put your views into RelativeLayout to use that attribute. 这意味着,必须将视图放入RelativeLayout中才能使用该属性。
UPDATE UPDATE
Yep, you are putting your views to a FrameLayout
. 是的,您正在将视图放入FrameLayout
。 Consider changing it to LinearLayout
with vertical orientation or using RelativeLayout
with layout_below
for the RecyclerView
. 考虑将其更改为垂直方向的LinearLayout
,或将RelativeLayout
与layout_below
用于RecyclerView
。
Linear layout does not contain android: layout_below option. 线性布局不包含 android: layout_below选项。 So, you can use relative layout in place of linear layout to use android:layout_below option . 因此,您可以使用相对布局代替线性布局来使用android:layout_below选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.