esausilva
esausilva

Reputation: 2116

Creating menu list

I have looked all over the internet and haven't found my answer. Whenever one taps the physical menu button on a device, the menu comes out and let's say we tap on Settings, the following view appears

enter image description here

I would like to know how to create this type of menu with different groups, in the above example, group "Spades Settings" and group "Partner Spades Options"

Is there a specific way of creating them or is it just a layout with a list?

Thanks

Upvotes: 1

Views: 1428

Answers (1)

Tim
Tim

Reputation: 5767

These are called "Preference Categories". Try this in eclipse

Right click on the /res/values/xml folder.

Go to New... Android XML File.

Call the file test.xml and select "Preference" radio button. Click Finish

The file should now open in with the Android Resources XML Editor

Click on the "PreferenceScreen" element.

Click "Add..."

Select PreferenceCategory

Click on the PreferenceCategory element.

Open the "Attributes from Preference" settings.

In the title box add "Partner Spades Options"

Here is the XML just in case.

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory android:title="Partner Spades Options">
    </PreferenceCategory>
</PreferenceScreen>

Use the editor to add checkboxes or other preferences to these sub categories.

You could also look at the Android API demos. Look at the /res/xml/preferences.xml file

Upvotes: 1

Related Questions