teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

7

画像削除

2016/10/06 04:22

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,3 @@
1
- ![イメージ説明](46d2ae73084235cb927f76ddc7251ce5.png)
2
- 既存のこのアプリ画面の緑とItem1の間に、タブメニューを追加しようとしています。
3
-
4
- そこで、Item8のスペースを削って、その分タブメニューを追加してItem1から下を全部ずらそうと思っています。
5
1
  ```ここに言語を入力
6
2
  <FrameLayout
7
3
  android:layout_width="match_parent"

6

修正

2016/10/06 04:22

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -125,31 +125,27 @@
125
125
  ```
126
126
 
127
127
  ```ここに言語を入力
128
+
128
- <android.support.design.widget.AppBarLayout
129
+ <TabHost
130
+
129
131
  android:layout_width="match_parent"
130
- android:layout_height="wrap_content"
132
+ android:layout_height="match_parent"
131
- android:theme="@style/AppTheme.AppBarOverlay">
133
+ android:id="@android:id/tabcontent"
134
+ android:layout_alignParentTop="true"
135
+ android:layout_alignParentStart="true">
132
136
 
133
- <android.support.v7.widget.Toolbar
137
+ <LinearLayout
134
- android:id="@+id/toolbar"
135
138
  android:layout_width="match_parent"
136
- android:layout_height="?attr/actionBarSize"
139
+ android:layout_height="wrap_content"
137
- android:background="?attr/colorPrimary"
140
+ android:orientation="vertical">
138
- app:popupTheme="@style/AppTheme.PopupOverlay"/>
139
141
 
140
- </android.support.design.widget.AppBarLayout>
141
-
142
- <TabHost
143
- android:layout_width="match_parent"
144
- android:layout_height="match_parent">
145
-
146
142
  <TabWidget
143
+ android:id="@android:id/tabs"
147
144
  android:layout_width="match_parent"
148
- android:layout_height="match_parent">
145
+ android:layout_height="wrap_content" ></TabWidget>
149
146
 
150
- </TabWidget>
147
+ <FrameLayout
151
148
 
152
- <FrameLayout
153
149
  android:layout_width="match_parent"
154
150
  android:layout_height="match_parent">
155
151
 
@@ -159,6 +155,7 @@
159
155
  android:layout_height="match_parent"/>
160
156
 
161
157
  </FrameLayout>
158
+ </LinearLayout>
162
159
  </TabHost>
163
160
  </LinearLayout>
164
161
  ```

5

編集

2016/10/05 06:52

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -138,12 +138,17 @@
138
138
  app:popupTheme="@style/AppTheme.PopupOverlay"/>
139
139
 
140
140
  </android.support.design.widget.AppBarLayout>
141
+
141
- <TabHost
142
+ <TabHost
142
- android:layout_width="match_parent"
143
- android:layout_height="match_parent">
144
- <TabWidget
145
143
  android:layout_width="match_parent"
146
144
  android:layout_height="match_parent">
145
+
146
+ <TabWidget
147
+ android:layout_width="match_parent"
148
+ android:layout_height="match_parent">
149
+
150
+ </TabWidget>
151
+
147
152
  <FrameLayout
148
153
  android:layout_width="match_parent"
149
154
  android:layout_height="match_parent">
@@ -154,9 +159,6 @@
154
159
  android:layout_height="match_parent"/>
155
160
 
156
161
  </FrameLayout>
157
- </TabWidget>
158
-
159
- </TabHost>
162
+ </TabHost>
160
-
161
163
  </LinearLayout>
162
164
  ```

4

修正コード追記

2016/10/05 06:00

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -122,4 +122,41 @@
122
122
  </FrameLayout>
123
123
 
124
124
  </LinearLayout>
125
+ ```
126
+
127
+ ```ここに言語を入力
128
+ <android.support.design.widget.AppBarLayout
129
+ android:layout_width="match_parent"
130
+ android:layout_height="wrap_content"
131
+ android:theme="@style/AppTheme.AppBarOverlay">
132
+
133
+ <android.support.v7.widget.Toolbar
134
+ android:id="@+id/toolbar"
135
+ android:layout_width="match_parent"
136
+ android:layout_height="?attr/actionBarSize"
137
+ android:background="?attr/colorPrimary"
138
+ app:popupTheme="@style/AppTheme.PopupOverlay"/>
139
+
140
+ </android.support.design.widget.AppBarLayout>
141
+ <TabHost
142
+ android:layout_width="match_parent"
143
+ android:layout_height="match_parent">
144
+ <TabWidget
145
+ android:layout_width="match_parent"
146
+ android:layout_height="match_parent">
147
+ <FrameLayout
148
+ android:layout_width="match_parent"
149
+ android:layout_height="match_parent">
150
+
151
+ <ListView
152
+ android:id="@+id/list_collection"
153
+ android:layout_width="match_parent"
154
+ android:layout_height="match_parent"/>
155
+
156
+ </FrameLayout>
157
+ </TabWidget>
158
+
159
+ </TabHost>
160
+
161
+ </LinearLayout>
125
162
  ```

3

追記

2016/10/05 05:36

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -75,4 +75,51 @@
75
75
  </FrameLayout>
76
76
 
77
77
  </LinearLayout>
78
+ ```
79
+
80
+ <追記>
81
+ ```ここに言語を入力
82
+ <?xml version="1.0" encoding="utf-8"?>
83
+ <LinearLayout
84
+ xmlns:android="http://schemas.android.com/apk/res/android"
85
+ xmlns:app="http://schemas.android.com/apk/res-auto"
86
+ xmlns:tools="http://schemas.android.com/tools"
87
+ android:id="@+id/root"
88
+ android:layout_width="match_parent"
89
+ android:layout_height="match_parent"
90
+ android:orientation="vertical"
91
+ android:fitsSystemWindows="true"
92
+ tools:context="com.xxxxx.xxxxxxx.activity.xxxxxxActivity">
93
+
94
+ <android.support.design.widget.AppBarLayout
95
+ android:layout_width="match_parent"
96
+ android:layout_height="wrap_content"
97
+ android:theme="@style/AppTheme.AppBarOverlay">
98
+
99
+ <android.support.v7.widget.Toolbar
100
+ android:id="@+id/toolbar"
101
+ android:layout_width="match_parent"
102
+ android:layout_height="?attr/actionBarSize"
103
+ android:background="?attr/colorPrimary"
104
+ app:popupTheme="@style/AppTheme.PopupOverlay"/>
105
+
106
+ </android.support.design.widget.AppBarLayout>
107
+
108
+ <TabHost
109
+ android:layout_width="match_parent"
110
+ android:layout_height="match_parent">
111
+ </TabHost>
112
+
113
+ <FrameLayout
114
+ android:layout_width="match_parent"
115
+ android:layout_height="match_parent">
116
+
117
+ <ListView
118
+ android:id="@+id/list_collection"
119
+ android:layout_width="match_parent"
120
+ android:layout_height="match_parent"/>
121
+
122
+ </FrameLayout>
123
+
124
+ </LinearLayout>
78
125
  ```

2

コードの追記

2016/10/05 04:55

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -2,7 +2,7 @@
2
2
  既存のこのアプリ画面の緑とItem1の間に、タブメニューを追加しようとしています。
3
3
 
4
4
  そこで、Item8のスペースを削って、その分タブメニューを追加してItem1から下を全部ずらそうと思っています。
5
-
5
+ ```ここに言語を入力
6
6
  <FrameLayout
7
7
  android:layout_width="match_parent"
8
8
  android:layout_height="match_parent">
@@ -18,6 +18,7 @@
18
18
 
19
19
  </FrameLayout>
20
20
  </LinearLayout>
21
+ ```
21
22
 
22
23
 
23
24
  太字にしたところが今回追加したところなんですが、これだと「RelativeLayout」と「ListView」が被って表示されてしまいます。
@@ -32,4 +33,46 @@
32
33
  できましたら、TabHostを使いたいと思っています。
33
34
  既存のXMLをどうTabHostに入れ込めばいいかご教授いただきたいです。
34
35
 
35
- よろしくお願いします。
36
+ よろしくお願いします。
37
+
38
+ <追記>
39
+ ```ここに言語を入力
40
+ <?xml version="1.0" encoding="utf-8"?>
41
+ <LinearLayout
42
+ xmlns:android="http://schemas.android.com/apk/res/android"
43
+ xmlns:app="http://schemas.android.com/apk/res-auto"
44
+ xmlns:tools="http://schemas.android.com/tools"
45
+ android:id="@+id/root"
46
+ android:layout_width="match_parent"
47
+ android:layout_height="match_parent"
48
+ android:orientation="vertical"
49
+ android:fitsSystemWindows="true"
50
+ tools:context="com.xxxxx.xxxxxxx.activity.xxxxxxActivity">
51
+
52
+ <android.support.design.widget.AppBarLayout
53
+ android:layout_width="match_parent"
54
+ android:layout_height="wrap_content"
55
+ android:theme="@style/AppTheme.AppBarOverlay">
56
+
57
+ <android.support.v7.widget.Toolbar
58
+ android:id="@+id/toolbar"
59
+ android:layout_width="match_parent"
60
+ android:layout_height="?attr/actionBarSize"
61
+ android:background="?attr/colorPrimary"
62
+ app:popupTheme="@style/AppTheme.PopupOverlay"/>
63
+
64
+ </android.support.design.widget.AppBarLayout>
65
+
66
+ <FrameLayout
67
+ android:layout_width="match_parent"
68
+ android:layout_height="match_parent">
69
+
70
+ <ListView
71
+ android:id="@+id/list_collection"
72
+ android:layout_width="match_parent"
73
+ android:layout_height="match_parent"/>
74
+
75
+ </FrameLayout>
76
+
77
+ </LinearLayout>
78
+ ```

1

追記

2016/10/05 04:36

投稿

SmartBuzz
SmartBuzz

スコア81

title CHANGED
File without changes
body CHANGED
@@ -23,4 +23,13 @@
23
23
  太字にしたところが今回追加したところなんですが、これだと「RelativeLayout」と「ListView」が被って表示されてしまいます。
24
24
  そこで、RelativeLayoutを50dpで一番上に表示して、その下にくっつく形でListViewを表示する時は、どうかけばいいんでしょうか?
25
25
 
26
- ご教授のほどよろしくお願いいたします。
26
+ ご教授のほどよろしくお願いいたします。
27
+
28
+
29
+
30
+ <追記>
31
+ 今回タブの実現方法がまったく持って違っていました…。
32
+ できましたら、TabHostを使いたいと思っています。
33
+ 既存のXMLをどうTabHostに入れ込めばいいかご教授いただきたいです。
34
+
35
+ よろしくお願いします。