Форум программистов, компьютерный форум, киберфорум
Программирование Android
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.67/3: Рейтинг темы: голосов - 3, средняя оценка - 4.67
1 / 1 / 0
Регистрация: 15.05.2014
Сообщений: 16
1

Подскажите по расположению элементов (Layouts)

15.12.2015, 01:03. Показов 607. Ответов 2
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Подскажите, как расположить элементы, так, чтобы "Кнопка 1" была вверху экарана, а "Кнопки 7, 8" внизу, а Кнопки 2-6 остались по середине экрана?
Свойства Top и Bottom установлены
XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:columnCount="1"
    android:orientation="horizontal"
 
    android:rowCount="7"
   >
 
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal|top">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 1"
            android:id="@+id/button"
            android:layout_weight="1" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 2"
            android:id="@+id/button1"
            android:layout_weight="1"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 3"
            android:id="@+id/button2"
            android:layout_weight="1"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 4"
            android:id="@+id/button3"
            android:layout_weight="1"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 5"
            android:id="@+id/button4"
            android:layout_weight="1"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 6"
            android:id="@+id/button5"
            android:layout_weight="1"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_horizontal|bottom">
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 7"
            android:id="@+id/button6"
            android:layout_gravity="left"
            android:layout_weight="1" />
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Button 8"
            android:id="@+id/button7"
            android:layout_gravity="right"
            android:layout_weight="1" />
    </LinearLayout>
 
</GridLayout>
Миниатюры
Подскажите по расположению элементов (Layouts)  
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
15.12.2015, 01:03
Ответы с готовыми решениями:

Qt layouts
Добрый день. У меня есть виджет, с такой структурой: Vertical Layout - Label - Vertical Layout...

qt, дизайнер и layouts
Как я пользуюсь layout -ами вручную: // ui-&gt;form - это, например, QFrame QVBoxLayout*...

Layouts. Swing
Добрый вечер. Образец прикреплен к теме Какие менеджеры компоновок лучше использовать?При помощи...

Layouts или расположение вручную?
Алоха! Я новичок в java, недавно закончил Делфи. Появился очень важный для меня вопрос: что...

2
66 / 56 / 6
Регистрация: 28.12.2011
Сообщений: 322
15.12.2015, 02:32 2
XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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">
 
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button" />
 
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true">
 
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button2" />
 
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button3"/>
 
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button6" />
 
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button7" />
 
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button8" />
    </LinearLayout>
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">
 
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button4"
            android:layout_alignParentBottom="true"
            android:layout_weight="1" />
 
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="New Button"
            android:id="@+id/button5"
            android:layout_weight="1" />
    </LinearLayout>
 
</RelativeLayout>
Миниатюры
Подскажите по расположению элементов (Layouts)  
0
91 / 91 / 14
Регистрация: 10.10.2015
Сообщений: 307
Записей в блоге: 1
15.12.2015, 06:35 3
не совсем так. это налезет друг на друга на маленьком экране. возможно что уже при повороте налезет.
LinearLayout - снаружи, и у него 3 зоны: верхняя кнопка, середина RelativeLayout и нижняя пара кнопок. в средней зоне, для маленьких экранов, может быть надо будет добавить скролл.

вот пример. для понимания центральной зоны, добавте еще штук 10 кнопок к четырем, которые там есть.

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"
    >
 
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="top btn"
        />
 
 
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        >
 
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            >
 
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                >
 
                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="mid btn 1"
                    />
 
                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="mid btn 1"
                    />
 
                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="mid btn 1"
                    />
 
                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="mid btn 1"
                    />
 
 
            </LinearLayout>
        </ScrollView>
    </RelativeLayout>
 
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
 
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="bottom btn 1"
            />
 
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="bottom btn 2"
            />
 
    </LinearLayout>
 
</LinearLayout>
1
15.12.2015, 06:35
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
15.12.2015, 06:35
Помогаю со студенческими работами здесь

FAQ по расположению куллеров в корпусах.
В данной статье хочу привести три варианта расположения куллеров в корпусах типа ATX! 1.Куллер на...

Вывести layouts/store.html.erb
Здравствуйте.В проекте depot создал файл depot.css в директории public/images/stylesheets.Нужно...

Как сделать автоматическое добавление Layouts?
Есть такая разметка для андроид приложения: &lt;RelativeLayout...

Отстутствует разрешение на доступ к расположению файлов
Здравствуйте! Появилась вот такая проблемка после перестановки XP на 7: &quot;Средство просмотра...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru