PreferenceActivityとFragmentを使って設定画面を作っています。
参考:こちら
仕上げとして、下部に「設定を反映する」のようなボタンを使って、設定に沿った処理を行いたいと思っています。
そこで色々探してみたところ、ListViewと差し替えるという手段を見つけて実践しました。
参考:こちら
上手く配置されたのですが、何故か下部にあるボタンと設定画面が重なってしまいます。
LinearLayoutにも関わらず重なっており、ボタンを押してもその下にある設定項目にチェックが入ります。
ScrollViewでやっているときはweight=1がうまくいったのですが、PreferenceActivityは何か特殊な処理が必要なのでしょうか
linear.xml
xml
1<?xml version="1.0" encoding="utf-8"?> 2<LinearLayout 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 android:orientation="vertical" 5 android:layout_width="fill_parent" 6 android:layout_height="fill_parent"> 7 <ListView 8 android:id="@android:id/list" 9 android:layout_width="fill_parent" 10 android:layout_height="0dp" 11 android:layout_weight="1" /> 12 <LinearLayout 13 android:layout_width="match_parent" 14 android:background="#EDE6D6" 15 android:gravity="center_horizontal" 16 android:padding="10dp" 17 android:layout_height="wrap_content"> 18 19 <Button 20 android:id="@+id/settingButton" 21 android:layout_width="0dp" 22 android:layout_weight="1" 23 android:layout_height="wrap_content" 24 android:adjustViewBounds="true" 25 android:background="@drawable/underbutton_design" 26 android:textColor="#fff" 27 android:text="@string/settingButton" 28 android:layout_marginRight="10dp" 29 /> 30 </LinearLayout> 31</LinearLayout>
preference.xml
xml
1<?xml version="1.0" encoding="utf-8"?> 2 <PreferenceScreen 3 xmlns:android="http://schemas.android.com/apk/res/android"> 4 <PreferenceCategory 5 android:title="@string/preference_title01"> 6 </PreferenceCategory> 7 8 <PreferenceCategory android:title="@string/preference_title02"> 9 </PreferenceCategory> 10 </PreferenceScreen>
あなたの回答
tips
プレビュー