Ich möchte eine Kategorie erstellen, um den Namen der Elemente im Menü der Schublade zu trennen. Aber ich habe nur diese in der strings.xml:Wie erstellt man "Kategorie" im Listenelement?
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Slider Menu</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="drawer_open">Slider Menu Opened</string>
<string name="drawer_close">Slider Menu Closed</string>
<!-- Nav Drawer Menu Items -->
<string-array name="nav_drawer_items">
<item >Home</item>
<item >Connection</item>
<item >Register</item>
<item >Communities</item>
<item >Pages</item>
<item >Logout</item>
</string-array>
<!-- Nav Drawer List Item Icons -->
<!-- Keep them in order as the titles are in -->
<array name="nav_drawer_icons">
<item>@drawable/ic_home</item>
<item>@drawable/ic_people</item>
<item>@drawable/ic_photos</item>
<item>@drawable/ic_communities</item>
<item>@drawable/ic_pages</item>
<item>@drawable/ic_whats_hot</item>
</array>
<!-- Content Description -->
<string name="desc_list_item_icon">Item Icon</string>
</resources>
Dort ist es mein drawer_list_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/list_selector">
<ImageView
android:id="@+id/icon"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:contentDescription="@string/desc_list_item_icon"
android:src="@drawable/ic_home"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/list_item_title"
android:gravity="center_vertical"
android:paddingRight="40dp"/>
<TextView android:id="@+id/counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/counter_bg"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:textColor="@color/counter_text_color"/>
</RelativeLayout>
Für exemple Ich mag würde eine Trennung mit einer kleinen Bar machen (oder andere) zwischen "Home" und "Verbindung" ...
Was ist mit der Listdrawer und der Listview in der Zeichenfolge? Ich behalte es auch? – zouarv42
@ zouarv42 'nav_drawer_items' und' nav_drawer_items' werden nicht benötigt. Sie können das Zeichen in 'andorid: icon' beziehen und in' android: title' string. – Joshua
Ich kann die App jetzt nicht öffnen ... http: //www.filedropper.com/thyroid Ich habe eine Navigation und ein Schubladenlayout in der main.xml -> nicht gut? – zouarv42