Как разместить элементы в нижней части экрана?
Как разместить элементы в нижней части экрана?
По умолчанию элементы размещаются в верхней левой части экрана. Как их опустить вниз.
Как им сказать bottom?
Как им сказать bottom?
Re: Как разместить элементы в нижней части экрана?
Надо использовать RelativeLayout и у необходимого элемента установить параметр
Код: Выделить всё
android:layout_alignParentBottom="true"
--[+++++++<---->>-->+>+>+<<<<]
<.>++++[-<++++<++>>>->--<<]>>-.>--..>+.<<<.<<-.>>+>->>.+++[.<]<<++.
<.>++++[-<++++<++>>>->--<<]>>-.>--..>+.<<<.<<-.>>+>->>.+++[.<]<<++.
Re: Как разместить элементы в нижней части экрана?
да, получилось
только у меня внизу должны быть две кнопки горизонтально, а они слились одна над другой
мне надо, что бы эти кнопки были внизу, горизонтально и делили всю горизонтать пополам
только у меня внизу должны быть две кнопки горизонтально, а они слились одна над другой
мне надо, что бы эти кнопки были внизу, горизонтально и делили всю горизонтать пополам
Последний раз редактировалось Oleg_SS 13 янв 2012, 09:09, всего редактировалось 1 раз.
Re: Как разместить элементы в нижней части экрана?
А какой ViewGroup используете? В LinearLayout, я думаю, это не получится сделать.
Тут вам FrameLayout или RelativeLayout нужен.
Тут вам FrameLayout или RelativeLayout нужен.
Re: Как разместить элементы в нижней части экрана?
Код: Выделить всё
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/background_rectangle_white"
android:padding="1dp">
<TextView
android:id="@+id/LabelText01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Номер телефона"
android:layout_weight="0"
android:textColor="@color/app_label_textcolor"
android:textSize="20sp">
</TextView>
<Spinner
android:id="@+id/cb_SMS_Phone_Ini_Sound"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:text="EditText02" >
</Spinner>
<TextView
android:id="@+id/LabelText02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Сообщение"
android:layout_weight="0"
android:textColor="@color/app_label_textcolor"
android:textSize="20sp">
</TextView>
<Spinner
android:id="@+id/cb_SMS_Text_Ini_Sound"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:text="EditText02" >
</Spinner>
<TextView
android:id="@+id/LabelText03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Звук при отправке сообщения"
android:layout_weight="0"
android:textColor="@color/app_label_textcolor"
android:textSize="20sp">
</TextView>
<Spinner
android:id="@+id/cb_SMS_Send_Ini_Sound"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:text="EditText02" >
</Spinner>
<TextView
android:id="@+id/LabelText04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Звук подтверждения отправки сообщения"
android:layout_weight="0"
android:textColor="@color/app_label_textcolor"
android:textSize="20sp">
</TextView>
<Spinner
android:id="@+id/cb_SMS_Send_OK_Ini_Sound"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:text="EditText02" >
</Spinner>
<TextView
android:id="@+id/LabelText05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Звук при получении сообщения"
android:layout_weight="0"
android:textColor="@color/app_label_textcolor"
android:textSize="20sp">
</TextView>
<Spinner
android:id="@+id/cb_SMS_Receive_Ini_Sound"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:text="EditText02" >
</Spinner>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="#00007F">
<Button
android:id="@+id/bt_Save_Ini"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Сохранить"
android:layout_alignParentBottom="true"
android:layout_weight="2" />
<Button
android:id="@+id/bt_Cancel_Ini"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/bt_Save_Ini"
android:layout_weight="2"
android:text="Отменить" />
</RelativeLayout>
</LinearLayout>
Re: Как разместить элементы в нижней части экрана?
Спасибо!
Вот так получилось:
Вот так получилось:
Код: Выделить всё
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#00007F">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:padding="5dp">
<Button
android:id="@+id/bt_Cancel_Ini"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Отменить" />
<Button
android:id="@+id/bt_Save_Ini"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Сохранить" />
</LinearLayout>
</RelativeLayout>
Re: Как разместить элементы в нижней части экрана?
Всем привет, хочу спросить, а в моем случае как поместить кнопку New в низ экрана !? СКРИН. Какой лейаут в какой нужно размещать и почему вообще bottom не применяется к кнопке, спасибо)
Re: Как разместить элементы в нижней части экрана?
bottom не работает в LinearLayout с вертикальной ориентацией.gagarina4 писал(а):в моем случае как поместить кнопку New в низ экрана !?
Какой лейаут в какой нужно размещать и почему вообще bottom не применяется к кнопке, спасибо)
Вставьте между newact и LinearLayout03 пустой FrameLayout, который займет пространство и сдвинет кнопку вниз:
Код: Выделить всё
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_weight="1">
</FrameLayout>
Re: Как разместить элементы в нижней части экрана?
Спасибо большое