Reputation: 10757
Does anyone know how to replace a listview in navigationDrawer? I don't know how do navigation drawer without I have to do listView. I want to put imagenButtons and I would use setonclickListener for to go a fragment. I would like to put look like
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/tab_route_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
I want use imageButton.setOnClickListener But I don't know. Samebody any idea?
Upvotes: 2
Views: 1177
Reputation: 50588
FrameLayout contentFragme = findViewById(R.id.content_frame);
content_frame.findViewById(R.id.imageButton1).setOnClickListener(this);
Then change the fragments in the onClick()
based on their ids.
Here you go.
Upvotes: 1