在过去的几个小时里,我一直在发疯。无法正常工作:我有偏好、布局和活动。但我无法在布局中获得偏好...偏好:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:key="show_numbers"
android:title="show tile numbers"
android:summary="display the correct location of the tiles"
android:defaultValue="false" />
<ListPreference
android:key="grid_size"
android:title="Grid Size"
android:summary="puzzle size"
android:entries="@array/gridSizeTitles"
android:entryValues="@array/gridSizeValues"
android:defaultValue="3" />
</PreferenceScreen>
布局:
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainbgcolor" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/relativeLayoutHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/txtvHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="20dip"
android:text="Sliding Puzzle"
android:textColor="#242FF0"
android:textSize="20dip"
android:textStyle="bold|normal" />
<ImageView
android:id="@+id/ivHeader"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/txtvHeader"
android:contentDescription="Sliding Puzzle Icon"
android:scaleType="fitCenter"
android:src="@drawable/slidingpuzzleicon" />
</RelativeLayout>
<LinearLayout
android:id="@+id/LinearLayoutContent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/relativeLayoutHeader"
android:orientation="vertical" >
<!-- THIS IS THE PLACE I WANT TO GET THE PREFERENCE.
I ALSO WANT BE ABLE TO POSITION THE PREFERENCE VIEWS. -->
</LinearLayout>
</RelativeLayout>
欢迎任何帮助。
在此先感谢,奥利夫