Reputation: 723
I am making an Android app and am nearly finished.
When I started the app, I made my main pages as Activity type using buttons for the user to perform actions.
Now that I'm nearly done, I thought it'd be much nicer to change the buttons to an image and text, something like:
Is there a way to put a listview in an Activity or do I need to redo all of those pages and recreate them extended from Listview instead of Activity?
Upvotes: 0
Views: 152
Reputation: 10948
You certainly can. This works for me.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android_orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingLeft="4dip"
android:paddingRight="5dp">
<ListView android:id="@+id/your_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout >
In your Java code, put in something like this:
ListView listView = (ListView) findViewById(R.id.your_list);//listView should be global
Upvotes: 2