回答編集履歴

1

FrameLayoutを使ったシンプルな回答に変更

2018/07/02 09:25

投稿

kakajika
kakajika

スコア3131

test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- WebViewの上に重ねてViewを表示したいのであれば、重ねて表示するのに対応したレイアウトを使いましょう。ご質問xmlの場合ConstraintLayoutがすでにそれに対応していますので、その直下にWebViewとButtonを配置してみてはいかがしょう?LinearLayoutはその場合不要かと思います。
5
+ WebViewの上に重ねてViewを表示したいのであれば、重ねて表示するのに対応したレイアウトを使いましょう。一番シンプルなのはFrameLayoutを使用して、その直下にWebViewとButtonを配置することです。
6
6
 
7
7
 
8
8
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  <?xml version="1.0" encoding="utf-8"?>
12
12
 
13
- <android.support.constraint.ConstraintLayout
13
+ <FrameLayout
14
14
 
15
15
  xmlns:android="http://schemas.android.com/apk/res/android"
16
16
 
@@ -34,9 +34,7 @@
34
34
 
35
35
  android:layout_width="match_parent"
36
36
 
37
- android:layout_height="match_parent"
37
+ android:layout_height="match_parent" />
38
-
39
- android:layout_alignParentLeft="true" />
40
38
 
41
39
 
42
40
 
@@ -48,14 +46,10 @@
48
46
 
49
47
  android:layout_height="wrap_content"
50
48
 
51
- android:text="Button"
49
+ android:text="Button" />
52
-
53
- tools:layout_editor_absoluteX="148dp"
54
-
55
- tools:layout_editor_absoluteY="172dp" />
56
50
 
57
51
 
58
52
 
59
- </android.support.constraint.ConstraintLayout>
53
+ </FrameLayout>
60
54
 
61
55
  ```