Android: Помощь с двумя линейными макетами, которые накладываются друг на друга! - PullRequest
0 голосов
/ 21 июля 2011

Я хотел бы иметь две линейные раскладки внутри третьей родительской раскладки.Мне бы хотелось, чтобы первая линейная ориентация была горизонтальной, а вторая - вертикальной.

Я попытался добиться этого с помощью следующего кода.Однако вторая линейная схема не отображается.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#FFFFFF">
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal"
  android:gravity="center_horizontal"
  >
<ImageButton android:id="@+id/ImageButton01"
android:layout_width="80px" 
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
</LinearLayout>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:gravity="center_horizontal"
  >
<ImageView android:id="@+id/ImageView01"
    android:layout_width="200px" 
    android:layout_height="81px" 
    android:src="@drawable/logo"
    android:adjustViewBounds="true"
    android:layout_marginTop="15px"/>
<TextView android:id="@+id/TextView01"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:textColor="#9CC721"/>
</LinearLayout>
</LinearLayout>

Любая помощь будет оценена.

Заранее спасибо.

1 Ответ

1 голос
/ 21 июля 2011

Я думаю, вам нужно указать атрибут android:orientation внутри родительского макета.

Советы:

dp иdip предпочтительнее, чем px.

Обновление:

ваш родительский макет должен выглядеть следующим образом:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#FFFFFF"
android:orientation="vertical">

представление вашего изображения на второмподкомпоновка должна быть такой:

<ImageView android:id="@+id/ImageView01"
    android:layout_width="200px" 
    android:layout_height="81px" 
    android:src="@drawable/logo"
    android:adjustViewBounds="true"
    android:layout_marginTop="15px"
 android:scaleType="center"/>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...