Создайте 2 FrameLayouts друг под другом - PullRequest
0 голосов
/ 12 мая 2019

У меня проблема ... Я хочу создать 2 FrameLayouts ниже друг друга, поэтому я попробовал этот код:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#071c3f">
    <FrameLayout
        android:id="@+id/ActionBarContainer"
        android:layout_width="match_parent"
        android:layout_height="75dp"/>
    <FrameLayout
        android:id="@+id/LayoutContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

Теперь отображается первый FrameLayout, но второй FrameLayout не виден наэкран.

Что я делаю не так ???

1 Ответ

0 голосов
/ 13 мая 2019

Значение по умолчанию android:orientation равно по горизонтали .Поэтому, если вы установите android:layout_width="match_parent", вы не увидите второго FrameLayout в горизонтальном направлении.

Я хочу создать 2 FrameLayouts друг над другом

Добавитьandroid:orientation="vertical" будет работать:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#374233"
    android:orientation="vertical">
    <FrameLayout
        android:id="@+id/ActionBarContainer"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        >   

    </FrameLayout>

    <FrameLayout
        android:id="@+id/LayoutContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </FrameLayout>
</LinearLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...