public class MainActivity extends AppCompatActivity {
 
    private ListView mDrawerList;
    private ArrayAdapter<String> mAdapter;
    ...
 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        setContentView(R.layout.activity_main);
 
 
        mDrawerList = (ListView)findViewById(R.id.navList);
 
        mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
 
        addDrawerItems();
 
        mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                final Dialog aboutDialog = new Dialog(MainActivity.this);
                aboutDialog.setContentView(R.layout.about);
                aboutDialog.setCancelable(true);
                aboutDialog.show();
            }
        });
    }
 
 
    private void addDrawerItems() {
        String[] osArray = { "Profil bearbeiten", "Ein Problem melden", "Nutzungsbedingungen", "Kontakt", "Über uns" };
        mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
        mDrawerList.setAdapter(mAdapter);
    }
 
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.rkcsd.apps.mobile.michaelrohde.kilometerrabatt.MainActivity">
 
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/appbar_padding_top"
        android:theme="@style/AppTheme.AppBarOverlay">
 
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
            ...
dev/java/androidmenu.txt · Zuletzt geändert: 31.03.2017, 12:22 Uhr von wikiredaktion@reneknipschild.de
 
Falls nicht anders bezeichnet, ist der Inhalt dieses Wikis unter der folgenden Lizenz veröffentlicht: CC Attribution-Share Alike 3.0 Unported
rkWiki wird freundlich bereitgestellt von
René Knipschild – Custom Software Development, Ihr Partner in Sachen IT-Beratung & individueller Software-Entwicklung. www.IT-Beratung-Nordhessen.de – Made in Germany
Copyleft inverted copyright sign 2012-2024 René Knipschild | www.reneknipschild.net | Impressum | Datenschutz