###fragamentで覆ったmain画面のボタンが浮き出る。
Android studioでノベルゲームを作っています。今、以下のようなオプション画面を実現したく奮闘しています。
![
しかし、オプションをfragmentで作ると以下の画像のようにゲームスタート画面のボタンが浮き出てしまいます。さらにそれを押せてしまいます。(本来ならcreditとtwitterでいい。)
以前もこの画面構築について相談させていただいたのですが、そのとき「背景を半透明にしたレイアウトの中にオプション画面を入れ、そのレイアウトをFragmentに設定して画面全体に表示されるよう配置すればいい」というアドバイスをいただきました。
それに基づいて画面を作ったのですが、やはり浮き出てしまいます。
以下にコードを載せます。これをどのように改造すればよいのでしょうか?指針だけでも教えていただけたらありがたいです・・・・
fragment_option.xml
lang
1<?xml version="1.0" encoding="utf-8"?> 2<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 android:background="#7f000000" 8 tools:context=".OptionFragment"> 9 10 11 <ImageView 12 android:id="@+id/imageView" 13 android:src="@color/colorPrimary" 14 android:layout_width="300dp" 15 android:layout_height="300dp" 16 app:layout_constraintBottom_toBottomOf="parent" 17 app:layout_constraintEnd_toEndOf="parent" 18 app:layout_constraintStart_toStartOf="parent" 19 app:layout_constraintTop_toTopOf="parent" /> 20 21 <TextView 22 android:id="@+id/option_title" 23 android:layout_width="wrap_content" 24 android:layout_height="wrap_content" 25 android:layout_marginEnd="8dp" 26 android:layout_marginStart="8dp" 27 android:layout_marginTop="300dp" 28 android:text="Option" 29 android:textColor="@color/white" 30 android:textSize="30sp" 31 app:layout_constraintEnd_toEndOf="parent" 32 app:layout_constraintStart_toStartOf="parent" 33 app:layout_constraintTop_toTopOf="parent" /> 34 35 <Button 36 android:id="@+id/button_credit" 37 android:layout_width="wrap_content" 38 android:layout_height="wrap_content" 39 android:layout_marginStart="65dp" 40 android:layout_marginTop="64dp" 41 android:onClick="goCredit" 42 android:text="Credit" 43 app:layout_constraintStart_toStartOf="parent" 44 app:layout_constraintTop_toBottomOf="@+id/option_title" /> 45 46 <Button 47 android:id="@+id/button_twitter" 48 android:layout_width="wrap_content" 49 android:layout_height="wrap_content" 50 android:layout_marginEnd="64dp" 51 android:onClick="goTwitter" 52 android:text="Twitter" 53 app:layout_constraintEnd_toEndOf="parent" 54 app:layout_constraintTop_toTopOf="@+id/button_credit" /> 55 56</android.support.constraint.ConstraintLayout> 57
ActiivityTitle
lang
1<?xml version="1.0" encoding="utf-8"?> 2<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 android:background="@color/colorPrimaryDark" 8 tools:context=".TitleActivity"> 9---略 10 <FrameLayout 11 android:id="@+id/fragment" 12 android:name="com.example.android.test.OptionFragment" 13 android:layout_width="match_parent" 14 android:layout_height="match_parent" 15 app:layout_constraintBottom_toBottomOf="parent" 16 app:layout_constraintEnd_toEndOf="parent" 17 app:layout_constraintStart_toStartOf="parent" 18 app:layout_constraintTop_toTopOf="parent" /> 19 20 21</android.support.constraint.ConstraintLayout>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/17 11:20