Android : Mixing preference screen with normal xml file in android

on Friday, March 20, 2015


I'm new to android, so pardon me if this question is too simple. I want to make an xml file that remembers if the user want to be stay login or not, by checking the checkbox. here is the sample layout (I just used a regular checkbox in the image below). enter image description here


Is it possible to mix a PreferenceScreen with a regular LinearLayout in an xml file? if yes, can you show me the structure?


I tried doing this, but i get an error.



<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:weightSum="2">

<PreferenceScreen>
<CheckBoxPreference
android:defaultValue="false"
android:key="checkbox"
android:summary="remember me">
</CheckBoxPreference>
</PreferenceScreen>

<TextView
android:id="@+id/tvRegister"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="140dp"
android:textSize="20dp"
android:text="Not yet member?"
android:layout_weight="1"
android:textColor="#5F61D9" />


I want it to look like just like the picture above.


0 comments:

Post a Comment