現在タブで表示したレイアウトが以下のように画面の半分しか表示されていません。
タブのxmlは以下のようになっています。
android
1<TabHost 2 android:layout_width="match_parent" 3 android:layout_height="wrap_content" 4 android:id="@+id/tabHost" 5 android:layout_alignParentTop="true"> 6 7 <LinearLayout 8 android:layout_width="match_parent" 9 android:layout_height="wrap_content" 10 android:orientation="vertical"> 11 12 <TabWidget 13 android:id="@android:id/tabs" 14 android:layout_width="match_parent" 15 android:layout_height="wrap_content"/> 16 17 <FrameLayout 18 android:id="@android:id/tabcontent" 19 android:layout_width="match_parent" 20 android:layout_height="wrap_content"> 21 22 <LinearLayout 23 android:id="@+id/tab_hitokoto" 24 android:layout_width="match_parent" 25 android:layout_height="wrap_content" 26 android:orientation="vertical"> 27 </LinearLayout> 28 29 <LinearLayout 30 android:id="@+id/tab_recording" 31 android:layout_width="match_parent" 32 android:layout_height="wrap_content" 33 android:orientation="vertical"> 34 <include layout="@layout/fragment_recording" /> 35 </LinearLayout> 36 37 <LinearLayout 38 android:id="@+id/tab_settings" 39 android:layout_width="match_parent" 40 android:layout_height="wrap_content" 41 android:orientation="vertical"> 42 <include layout="@layout/fragment_settings" /> 43 </LinearLayout> 44 </FrameLayout> 45 </LinearLayout> 46 </TabHost>
そしてその該当する画面のコードとxmlは以下のようになっています。
kotlin
1class SettingsFragment : Fragment() { 2 3 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle): View { 4 super.onCreateView(inflater, container, savedInstanceState) 5 6 return inflater.inflate(R.layout.fragment_settings, container, false) 7 } 8}
android
1<?xml version="1.0" encoding="utf-8"?> 2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" android:layout_height="match_parent" 4 android:background="#00FF00"> 5 6 <Button 7 android:id="@+id/button_profile" 8 android:background="@drawable/camera" 9 android:layout_width="300dp" 10 android:layout_height="300dp" 11 android:layout_centerInParent="true"/> 12 13</RelativeLayout>
なぜ画面の半分しかレイアウトが表示されていないのでしょうか?
どなたかわかる方がいれば教えていただきたいです。よろしくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/01/08 09:14