Nested PreferenceScreen : Screen « Hardware « Android






Nested PreferenceScreen

   


package app.test;

import android.os.Bundle;
import android.preference.PreferenceActivity;

public class Test extends PreferenceActivity
{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.main);
    }
}

//xml/main.xml



<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
  android:key="using_categories_in_root_screen"
  android:title="Categories"
  android:summary="Using Preference Categories">
  <PreferenceScreen
    android:key="meats_screen"
    android:title="Meats"
    android:summary="Preferences related to Meats">
    <CheckBoxPreference 
        android:key="fish_selection_pref"
      android:title="Fish" 
      android:summary="Fish is great for the healthy" />
    <CheckBoxPreference 
        android:key="chicken_selection_pref"
      android:title="Chicken" 
      android:summary="A common type of poultry" />
    <CheckBoxPreference 
        android:key="lamb_selection_pref"
      android:title="Lamb" 
      android:summary="Lamb is a young sheep" />
  </PreferenceScreen>
  <PreferenceScreen
    android:key="vegi_screen" 
    android:title="Vegetables"
    android:summary="Preferences related to vegetable">
    <CheckBoxPreference 
        android:key="tomato_selection_pref"
      android:title="Tomato" 
      android:summary="It's actually a fruit" />
    <CheckBoxPreference 
        android:key="potato_selection_pref"
      android:title="Potato" 
      android:summary="My favorite vegetable" />
  </PreferenceScreen>
</PreferenceScreen>

   
    
    
  








Related examples in the same category

1.Multiscreen size
2.Get the size of Default Display Screen
3.Screen Orientation
4.Rows have different number of columns and content doesn't fit on screen: column 4 of row 2 shrinks all of the other columns
5.Demonstrates the Tab scrolling when too many tabs are displayed to fit in the screen.
6.Using PreferenceScreen
7.Splash Screen
8.Get the optimal preview size for the given screen size.
9.Methods for converting between the physics world coordinates and the screen coordinates.
10.Get screen Orientation
11.add Home Screen Shortcut
12.Return the supported picture size that best fits on the device screen.
13.Screen Short
14.Set full screen mode