У меня есть две LinearLayout
структуры, подобные приведенным ниже.
<LinearLayout
android:orientation="vertical">
<LinearLayout
android:id="@+id/kanji"
android:layout_width="match_parent"
android:layout_height="120dp"/>
<LinearLayout
android:id="@+id/goi"
android:layout_width="match_parent"
android:layout_height="120dp">
</LinearLayout>
Проблема в том, что вторая LinearLayout
(id = goi
) не отображается должным образом.Я попытался изменить верхний макет на RelativeLayout
, но это тоже не сработало.
Почему это происходит?
Мой фактический код:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="@drawable/rounded_corner_2"
android:layout_margin="10dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/kanji"
android:layout_width="match_parent"
android:layout_height="120dp"
android:orientation="horizontal"
android:background="@drawable/rounded_corner_2"
android:layout_margin="0dp">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:text="漢"
android:textColor="@color/green"
android:gravity="center"
android:textSize="70sp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/rounded_corner_2"
android:layout_margin="10dp"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="漢字"
android:textColor="@color/green"
android:textSize="20sp"
android:gravity="left"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="15dp"
android:text="漢字"
android:textColor="@android:color/darker_gray"
android:textSize="10sp"
android:gravity="left"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ProgressBar
android:layout_width="160dp"
android:layout_height="match_parent"
style="?android:attr/progressBarStyleHorizontal"
android:outlineSpotShadowColor="@color/green"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="end"
android:text="100/140"
android:textColor="@android:color/darker_gray"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/goi"
android:layout_width="match_parent"
android:layout_height="120dp"
android:orientation="horizontal"
android:background="@drawable/rounded_corner_2"
android:layout_margin="0dp">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:text="漢"
android:textColor="@color/green"
android:gravity="center"
android:textSize="70sp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/rounded_corner_2"
android:layout_margin="10dp"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="漢字"
android:textColor="@color/green"
android:textSize="20sp"
android:gravity="left"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="15dp"
android:text="漢字"
android:textColor="@android:color/darker_gray"
android:textSize="10sp"
android:gravity="left"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ProgressBar
android:layout_width="160dp"
android:layout_height="match_parent"
style="?android:attr/progressBarStyleHorizontal"
android:outlineSpotShadowColor="@color/green"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="end"
android:text="100/140"
android:textColor="@android:color/darker_gray"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>