Я хочу создать такой же экран на андроиде:
и добиться этого, я напишу некоторые такие коды. Но я не делал то, что хочу. Текстовая область не существует на экране. Что мне делать? Любое мнение.. спасибо заранее..<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout123"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0"
android:gravity="fill">
<LinearLayout
android:id="@+id/linearLayout12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top" >
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="118dp"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:orientation="vertical" >
<Button android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="228dp"
android:layout_height="fill_parent"
android:layout_gravity="left" >
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a TextView" />
</LinearLayout>
</LinearLayout>
RelativeLayout выполнит то, что вы хотите
<?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/rightLayout"
android:layout_width="100dip"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:background="#003300"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="@+id/topLayout"
android:layout_toLeftOf="@id/rightLayout"
android:layout_width="fill_parent"
android:layout_height="100dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#330033"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="@+id/bottomLayout"
android:layout_toLeftOf="@id/rightLayout"
android:layout_below="@id/topLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:background="#334433"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
Результат как LinearLayouts и как кнопки /TextViews (так как я не был уверен, чего вы хотели):
Если вы используете LinearLayouts в качестве контейнера для хранения нескольких просмотров, оставьте его как есть.
Если вы планируете иметь только один вид в каждой из ваших "частей", измените LinearLayouts в моем файле макета на этот тип. Ex. если вы хотите, чтобы часть 1 была просто сменой кнопки
<LinearLayout
android:id="@+id/topLayout"
быть
<Button
android:id="@+id/topLayout"
Вложенные представления плохие, поэтому полезно избегать их, если вы можете
ты мог:
Main linear layout with vertical alignment
add a new linear layout with horizontal alignment
add a new linear layout with horizontal or vertical alignment
Таким образом, в первом макете (левая часть основного макета) вы добавляете новый линейный макет с горизонтальным выравниванием и добавляете два элемента, которые вы хотите. Во втором макете (правая часть основного макета) вы добавляете новый линейный макет или непосредственно объект, который хотите показать