質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

2240閲覧

【Android】Fragmentを全画面表示したい

rinchu_17

総合スコア24

XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2018/01/25 06:48

編集2018/01/25 10:01

閲覧ありがとうございます。

表題通り、自作フラグメントを全画面表示して、疑似的な画面遷移を行いたいのですが、どうしてもフラグメントが画面の一部に留まってしまいます。

レイアウトファイルに問題があると思われますのでソースコードを貼っておきます。
原因がわかる方いらっしゃいましたら、教えていただけると助かります。
よろしくお願いします。

↓Fragment側のレイアウト

xml

1<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:tools="http://schemas.android.com/tools" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:background="@android:color/background_light" 7 tools:context="jp.gr.java_conf.rinchu17.qanda.SetUpFragment"> 8 9 <android.support.constraint.ConstraintLayout 10 android:layout_width="match_parent" 11 android:layout_height="match_parent"> 12 13 <RadioGroup 14 android:id="@+id/setup_rdg_mode" 15 android:layout_width="0dp" 16 android:layout_height="wrap_content" 17 android:layout_marginEnd="16dp" 18 android:layout_marginStart="16dp" 19 android:layout_marginTop="8dp" 20 android:orientation="horizontal" 21 app:layout_constraintEnd_toEndOf="parent" 22 app:layout_constraintHorizontal_bias="0.0" 23 app:layout_constraintStart_toStartOf="parent" 24 app:layout_constraintTop_toTopOf="parent"> 25 26 <RadioButton 27 android:id="@+id/setup_rdb_all" 28 android:layout_width="wrap_content" 29 android:layout_height="wrap_content" 30 android:layout_weight="1" 31 android:checked="true" 32 android:text="全範囲" /> 33 34 <RadioButton 35 android:id="@+id/setup_rdb_badOnly" 36 android:layout_width="wrap_content" 37 android:layout_height="wrap_content" 38 android:layout_weight="1" 39 android:text="ニガテだけ" /> 40 41 <RadioButton 42 android:id="@+id/setup_rdb_specify" 43 android:layout_width="wrap_content" 44 android:layout_height="wrap_content" 45 android:layout_weight="1" 46 android:text="問題数指定" /> 47 48 </RadioGroup> 49 50 <TextView 51 android:id="@+id/textView3" 52 android:layout_width="wrap_content" 53 android:layout_height="wrap_content" 54 android:layout_marginLeft="16dp" 55 android:layout_marginStart="16dp" 56 android:text="出題順" 57 app:layout_constraintBottom_toBottomOf="@+id/setup_spn_order" 58 app:layout_constraintLeft_toLeftOf="parent" 59 app:layout_constraintStart_toStartOf="parent" 60 app:layout_constraintTop_toTopOf="@+id/setup_spn_order" 61 app:layout_constraintVertical_bias="1.0" /> 62 63 <TextView 64 android:id="@+id/textView2" 65 android:layout_width="wrap_content" 66 android:layout_height="wrap_content" 67 android:layout_marginBottom="8dp" 68 android:layout_marginLeft="16dp" 69 android:layout_marginStart="16dp" 70 android:layout_marginTop="8dp" 71 android:gravity="start|end" 72 android:text="出題数" 73 app:layout_constraintBottom_toBottomOf="@+id/setup_edtx_num" 74 app:layout_constraintLeft_toLeftOf="parent" 75 app:layout_constraintStart_toStartOf="parent" 76 app:layout_constraintTop_toTopOf="@+id/setup_edtx_num" 77 app:layout_constraintVertical_bias="1.0" /> 78 79 <EditText 80 android:id="@+id/setup_edtx_num" 81 android:layout_width="100dp" 82 android:layout_height="wrap_content" 83 android:layout_marginStart="8dp" 84 android:ems="10" 85 android:inputType="number" 86 android:labelFor="@+id/textView2" 87 app:layout_constraintStart_toEndOf="@+id/textView2" 88 app:layout_constraintTop_toBottomOf="@+id/setup_rdg_mode" /> 89 90 <Spinner 91 android:id="@+id/setup_spn_order" 92 android:layout_width="wrap_content" 93 android:layout_height="wrap_content" 94 android:layout_marginStart="8dp" 95 android:layout_marginTop="8dp" 96 app:layout_constraintStart_toEndOf="@+id/textView3" 97 app:layout_constraintTop_toBottomOf="@+id/setup_edtx_num" /> 98 99 <Button 100 android:id="@+id/setup_btn_go" 101 android:layout_width="0dp" 102 android:layout_height="120dp" 103 android:text="GO" 104 android:textSize="30sp" 105 app:layout_constraintBottom_toBottomOf="parent" 106 app:layout_constraintEnd_toEndOf="parent" 107 app:layout_constraintStart_toStartOf="parent" /> 108 109 <CheckBox 110 android:id="@+id/setup_chbx_badPriority" 111 android:layout_width="wrap_content" 112 android:layout_height="wrap_content" 113 android:layout_marginStart="16dp" 114 android:layout_marginTop="8dp" 115 android:text="ニガテを優先的に出題" 116 app:layout_constraintStart_toStartOf="parent" 117 app:layout_constraintTop_toBottomOf="@+id/setup_spn_order" /> 118 119 <CheckBox 120 android:id="@+id/setup_chbx_timeLimit" 121 android:layout_width="wrap_content" 122 android:layout_height="wrap_content" 123 android:layout_marginStart="16dp" 124 android:layout_marginTop="8dp" 125 android:text="制限時間を設ける" 126 app:layout_constraintStart_toStartOf="parent" 127 app:layout_constraintTop_toBottomOf="@+id/setup_chbx_badPriority" /> 128 129 <Spinner 130 android:id="@+id/setup_spn_timePick" 131 android:layout_width="0dp" 132 android:layout_height="wrap_content" 133 android:layout_marginStart="8dp" 134 app:layout_constraintBottom_toBottomOf="@+id/setup_chbx_timeLimit" 135 app:layout_constraintStart_toEndOf="@+id/setup_chbx_timeLimit" 136 app:layout_constraintTop_toTopOf="@+id/setup_chbx_timeLimit" /> 137 138 </android.support.constraint.ConstraintLayout> 139</FrameLayout>

↓Activity側のレイアウト

xml

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 tools:context="jp.gr.java_conf.rinchu17.qanda.SelectActivity"> 8 9 <android.support.v7.widget.RecyclerView 10 android:id="@+id/select_list" 11 android:layout_width="match_parent" 12 android:layout_height="match_parent" /> 13 14 <android.support.design.widget.FloatingActionButton 15 android:id="@+id/select_add" 16 android:layout_width="wrap_content" 17 android:layout_height="wrap_content" 18 android:layout_marginBottom="16dp" 19 android:layout_marginEnd="16dp" 20 android:clickable="true" 21 android:src="@android:drawable/ic_input_add" 22 app:layout_constraintBottom_toBottomOf="parent" 23 app:layout_constraintEnd_toEndOf="parent" /> 24 25 <LinearLayout 26 android:id="@+id/select_container" 27 android:layout_width="match_parent" 28 android:layout_height="match_parent" 29 android:orientation="vertical" /> 30 31</android.support.constraint.ConstraintLayout>

この"select_container"にActivityでFragmentをreplaceしてます。

実際の表示画面は、FragmentのButtonがCheckBoxあたりに重なるように、画面上半分くらいに凝縮されています。
Button以外は正しく表示されていますが、画面下端にパッドしているはずのButtonが画面中央あたりに出ています。
スクリーンショットを貼りたかったのですがなぜかイメージ挿入が反応しないので出来ませんでした。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yona

2018/01/25 08:52

具体的にどのような表示になりますか?どこの部分に隙間がありますか?
guest

回答1

0

ベストアンサー

setup_chbx_badPriorityはsetup_btn_goの下ですか?それなら、setup_chbx_badPriorityのlayout_constraintTop_toBottomOfはsetup_btn_goを設定すべきです。

また、select_containerの背景色に適当な色を付けて妥当な領域かどうかを確認してください。

投稿2018/01/25 10:53

編集2018/01/25 10:53
yona

総合スコア18155

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

rinchu_17

2018/01/25 11:04

すみません、下手な説明で誤解を生んでしまったようですね。申し訳ないです。 btn_go以外は画面上部から適当にレイアウトしていて、btn_goだけ他の位置に関係なく画面下端に表示したいのです。 containerに色をつけてみましたところ、container自体の領域は正常でした。しかし、Fragmentのレイアウトは恐らくbtn_go以外のレイアウトで必要な領域だけを使って、btn_goはその領域内の下端に表示されている、という状況です。
yona

2018/01/25 12:01

btn_goだけにして他のViewを一時的に削除してどうなるかを教えてください。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問