0
Я пытаюсь установить два LinearLayouts в RelativeLayout (rootelement). Я вижу только одну строку. Не следует ли, чтобы ÄÄandroid: layout_below ** заставляли второй Linearlayout располагаться ниже первого LinearLayout?Wrap linearlayouts в relativelayout
Что не так? Это потому, что LinearLayout сама по себе является ViewGroup?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:id="@+id/addon1_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/weapon1_id"
android:layout_width="100dp"
android:layout_height="26dp"
android:src="@mipmap/weapon1"
android:adjustViewBounds="true"
/>
<ImageView
android:layout_width="100dp"
android:layout_height="26dp"
android:src="@mipmap/buy_button"
android:adjustViewBounds="true"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/addon2_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_below="@+id/addon1_row">
<ImageView
android:id="@+id/weapon2_id"
android:layout_width="100dp"
android:layout_height="26dp"
android:src="@mipmap/weapon2"
android:adjustViewBounds="true"
/>
<ImageView
android:layout_width="100dp"
android:layout_height="26dp"
android:src="@mipmap/buy_button"
android:adjustViewBounds="true"
/>
</LinearLayout>
</RelativeLayout>
Вы действительно не нужен RelativeLayout, учитывая текущее расположение. Но я бы оптимизировал все это (ради производительности), используя один RelativeLayout без LinearLayouts ИЛИ с помощью GridView (опять же, без дополнительных LinearLayouts). –
@ Rotwang, спасибо, я буду считать, что – java