Hi i'm trying to put a listview inside a listview inside a listview.
The only problem is only the first listview is showing all elements correctly.
Every listview after that only contains one element.
UPDATE:
Creating my own non-scrollable listview fixed the problem.
https://stackoverflow.com/a/24629341/3713144
Here is some code:
activity_anlagen_details.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="#+id/tool_bar"
layout="#layout/tool_bar"></include>
<TextView
android:id="#+id/anlagenName_textview"
android:layout_width="0dp"
android:layout_height="60dp"
android:gravity="center|center_vertical"
android:padding="3dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
<View
android:layout_width="fill_parent"
android:layout_height="4dp"
android:background="#424242" />
<ListView
android:id="#+id/listChecklisten"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/RecyclerView"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#ffffff"
android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.DrawerLayout>
anlagen_checklisten_listview.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/checkliste_name"
android:layout_gravity="center_horizontal"
android:gravity="center|center_vertical"/>
<ListView
android:id="#+id/listChecklistenPunkte"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
and so on...
What i'm trying to do now is setting an ArrayAdapter for all listviews:
AnlagenDetailsActivity:
...
long anlagenId = getIntent().getLongExtra("anlagen_id", 0);
Log.d(logger, "Details for Anlage: " + anlagenId);
LocalAnlagenAccessor accessor = new LocalAnlagenAccessor(this);
Anlage anlage = accessor.readAnlage(anlagenId);
TextView anlagenName = (TextView) findViewById(R.id.anlagenName_textview);
anlagenName.setText(anlage.getName());
ListView listView = (ListView) findViewById(R.id.listChecklisten);
AnlagenChecklistenAdapter adapter = new AnlagenChecklistenAdapter(this);
listView.setAdapter(adapter);
adapter.addAll(anlage.getChecklisten());
...
AnlagenChecklistenAdapter:
...
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View checklisteView = inflater.inflate(R.layout.anlagen_checklisten_listview, parent, false);
TextView checklisteName = (TextView) checklisteView.findViewById(R.id.checkliste_name);
checklisteName.setText(getItem(position).getArt());
ListView listView = (ListView) checklisteView.findViewById(R.id.listChecklistenPunkte);
AnlagenChecklistenPunktAdapter adapter = new AnlagenChecklistenPunktAdapter(checklisteView.getContext());
listView.setAdapter(adapter);
adapter.addAll(getItem(position).getChecklistenPunkte());
return checklisteView;
}
...
The same goes on for one more listview.
What am I doing wrong here?
Related
For my App I need to create a layout similar to this:
I have been thinking about having a RecyclerView inside a CardView. But if I do it like that I have to create two separate row.xml (one for first and second row and the other for third and fourth). I was wondering if there is a simpler way to get the same result.
Can you point in the right direction?
Create it using Relative layout or linear layout,and set id for parent layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="#+id/card_view_notification"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
card_view:cardCornerRadius="2dp"
card_view:contentPadding="7dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:id="#+id/rel_one"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Version"
android:id="#+id/hedone"
android:textColor="#000000"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="5.3(123)"
android:textColor="#000000"
android:layout_below="#+id/hedone"
android:textSize="14sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#7B7A7F"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:id="#+id/relative_two"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Version"
android:id="#+id/hedtwo"
android:textColor="#000000"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Disponibile"
android:textColor="#000000"
android:layout_below="#+id/hedtwo"
android:textSize="14sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#7B7A7F"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:id="#+id/relative_three"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Your text"
android:textColor="#000000"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#7B7A7F"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:id="#+id/relative_four"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Yourtext"
android:textColor="#000000"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
OUTPUT
Take a listview and initially make bottom textview gone. Make it visible as and when needed. Using cardview wont help you create such layout.
Maybe you could create a single row.xml and hide the subtitle when it's necessary.
mySubtitleTextView.setVisibility(View.GONE) like that subtitle doesn't take any space and title is still in center.
I would suggest making multiple card views and using the getItemViewType method. You can set various view types for different layouts and in the onCreateViewHolder method you can inflate the card view based on the view type.
How to create RecyclerView with multiple view type?
First of all a point with in a RecyclerView there will be CardView not reverse .if you want to do it with RecyclerView then follow some steps like:
step 1:
create a Layout named as Activity_main.xml which having a RecyclerView like:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".ui.MainActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/recycler_view"
android:scrollbars="vertical"
></android.support.v7.widget.RecyclerView>
</RelativeLayout>
step 2. Create layout named as product_layout which having a CardView like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="100dp">
<!--<TextView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Products"-->
<!--android:gravity="center"/>-->
<!--<RelativeLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<TextView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:gravity="center"-->
<!--android:textStyle="italic"-->
<!--android:text="Products"-->
<!--android:textAppearance="?android:textAppearanceLarge"/>-->
<!--</RelativeLayout>-->
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardview">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/smartphone"
android:id="#+id/mobileimage"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SmartPhones"
android:layout_toRightOf="#+id/mobileimage"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:id="#+id/productname"
android:layout_alignParentTop="true"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
step 3. Now set first RecyclerView layout in MainActivity.java, if you are working on json then parse it after that set Your adapter like:
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
adapter = new ProductAdapter(list, getApplicationContext());
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
step 4. create an Adapter named as ProductAdapter.java dafile like:
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.dharmendras.productdetail.models.Products;
import com.example.dharmendras.productdetail.R;
import java.util.ArrayList;
public class ProductAdapter extends RecyclerView.Adapter <ProductAdapter.ProductsViewHolder> {
ArrayList<Products> products = new ArrayList<Products>();
private Context context;
public ProductAdapter(ArrayList<Products> products,Context context){
this.context = context;
this.products = products;
}
#Override
public ProductsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.product_layout,parent,false);
ProductsViewHolder productsViewHolder = new ProductsViewHolder(view);
return productsViewHolder;
}
#Override
public void onBindViewHolder(ProductsViewHolder holder, int position) {
Products pdt = products.get(position);
//Picasso.with(context).load(pdt.getImage_url()).resize(120, 60).into(holder.product_img);
//pdt.getProduct_name()
holder.product_name.setText(pdt.getProduct_name());
//Drawable myDrawable = context.getResources().getDrawable(pdt.getImage_url());
// int id = getContext().getResources().getIdentifier("imageName", "drawable", getContext().getPackageName());
// ImageView myImageView = (ImageView)findViewById(R.id.myImage);
//myImageView.setImageResource(R.drawable.icon);
// holder.product_img.setImageDrawable(pdt.getImage_url());
//imageView.setBackground(getResources().getDrawable(getResources().getIdentifier("name","id",getPackageName())));
String name = pdt.getImage_url();
int id = context.getResources().getIdentifier(name, "drawable",context.getPackageName());
Drawable drawable = context.getResources().getDrawable(id);
holder.product_img.setImageDrawable(drawable);
}
#Override
public int getItemCount() {
return products.size();
}
public static class ProductsViewHolder extends RecyclerView.ViewHolder{
ImageView product_img;
TextView product_name;
public ProductsViewHolder(View view){
super(view);
product_img = (ImageView) view.findViewById(R.id.mobileimage);
product_name = (TextView) view.findViewById(R.id.productname);
}
}
}
Step 5. if u want to add RecyclerView clickable then set onClickListener on RecyclerView in your Activity_main.java.
i have a listview. i set position 20(last position), after i want add footer start
item last listview to bottom.
description:
http://i.imgur.com/I5DFV.jpg
i have set height footer view. but i don't.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="10000dp"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="FOOTER"
android:background="#cf9f99" />
</LinearLayout>
listview :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".demoAddListViewFooterActivity">
<ListView
android:id="#+id/list_items"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
Activity :
LayoutInflater inflater = getLayoutInflater();
ViewGroup footer = (ViewGroup) inflater.inflate(R.layout.footer, listItem,
false);
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_list_item_1, numbers);
listItem.addFooterView(footer,
null,
false);
listItem.setAdapter(adapter);
listItem.setSelection(20);
can you help me.
having a trouble here with the sliding tabs. So I have completed the tutorial but when i had a ListView to my Pager it only shows on the bottom of the screen.
Here is my XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.example.ambidata.innovway.SlidingTabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="#android:color/white"/>
</LinearLayout>
And my XML from ListView:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/issue_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_row_selector"/>
</LinearLayout>
Fragment Code:
public class TabIssues extends Fragment {
private ListView mainListView ;
private CustomListAdapter_Issues listAdapter;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle b = getArguments();
int user_id = b.getInt("user_id");
boolean all = b.getBoolean("all");
WSConnectionIssues runner = new WSConnectionIssues(user_id, all);
runner.execute();
while (runner.download == AsyncTask.Status.RUNNING)
{
try
{
Thread.sleep(1);
} catch (Exception ex)
{
ex.printStackTrace();
}
}
View view = inflater.inflate(R.layout.activity_issues, container, false);
// Find the ListView resource.
mainListView = (ListView) view.findViewById(R.id.issue_list);
registerForContextMenu(mainListView);
// Create ArrayAdapter using the planet list.
View convertView = inflater.inflate(R.layout.row_issues, null);
listAdapter = new CustomListAdapter_Issues(this, runner.listIssues, convertView);
// Set the ArrayAdapter as the ListView's adapter.
mainListView.setAdapter(listAdapter);
return view;
}
Im using the phone for debug...as you can see blank...then the first item of my listview and if you scroll the others are there!
Could you try the listview layout as:
<?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="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/issue_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_row_selector"/>
</RelativeLayout>
I'm using this library for the fab implementation.
As you can see in this video, the fab position is changing when the fragment loads.
After debugging it, I found that the listview "setAdapter()" method causes the position change.
I don't have a clue why it's happening..
My layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:theme="#style/AppTheme.ActionBar" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="#id/toolbar">
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="#android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sad_face"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/no_leagues" />
</LinearLayout>
</FrameLayout>
<com.melnykov.fab.FloatingActionButton
android:id="#+id/fab_new_league"
android:src="#drawable/ic_action_add"
app:fab_colorNormal="#color/orange"
app:fab_colorPressed="#color/redDark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignBottom="#id/toolbar"
android:layout_marginBottom="-28dp"
android:layout_marginRight="28dp"
android:elevation="8dp"/>
</RelativeLayout>
My fragment
public class LeagueListFragment extends MyFragment {
#InjectView(android.R.id.list) ListView mListView;
#InjectView(android.R.id.empty) LinearLayout mEmpty;
public static Fragment newInstance() {
return new LeagueListFragment();
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_league_list, container, false);
ButterKnife.inject(this, view);
// Fetch league list and set up adapter
List<League> list = League.getAll();
mAdapter = new LeagueAdapter(getActivity(), list);
// Set up ListView
mListView.setEmptyView(mEmpty);
mListView.setDivider(new ColorDrawable(getResources().getColor(R.color.gray)));
mListView.setDividerHeight(2);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(this);
return view;
}
}
Margin changes in the runtime on pre-Lollipop because shadow mustn't be taken into account when margins are set.
Try to disable the shadow by :
fab:fab_shadow="false"
Fixing the issue is not expected for now.. (See makovkastar answer)
I am developing an android App.
I places LinearLayout on ListView. I would like to scroll LinearLayout united with ListView.
My xml is below.
Could you tell me how to implement above?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/header1"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="3dp"
android:choiceMode="singleChoice"
android:orientation="vertical" >
・・・
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:choiceMode="singleChoice" />
</LinearLayout>
You should not put a ListView inside a ScrollView due to it being extremely expensive and defeats the purpose a ListView. Use a LinearLayout/RelativeLayout instead.
If you would like to populate the ListView items with a LinearLayout you will need to create an adapter that will get the data and populate the listView.
Here is some code that takes String values and displays them in the list.
public class MySimpleArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] values;
public MySimpleArrayAdapter(Context context, String[] values) {
super(context, R.layout.rowlayout, values);
this.context = context;
this.values = values;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.rowlayout, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
textView.setText(values[position]);
// change the icon for Windows and iPhone
String s = values[position];
if (s.startsWith("iPhone")) {
imageView.setImageResource(R.drawable.no);
} else {
imageView.setImageResource(R.drawable.ok);
}
return rowView;
}
}
Where you inflate the rowlayout in the getView - This will be your LinearLayout.
http://www.vogella.com/tutorials/AndroidListView/article.html#androidlists_adapterintro - For more information.
Use ScrollView (example) :
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/header1"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="3dp"
android:choiceMode="singleChoice"
android:orientation="vertical" >
・・・
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:choiceMode="singleChoice" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
Remember that ScrollView can only have one child attribute, so you can f.e. use a Relative Layout to encapsulate LinearLayout and ListView
ListView has its own ScrollView, If you want to scroll LinearLayout then follow the this code.
Declare Scroll-view as parent and declare only one child Linearlayout inside it (Scrollview contain only one child)
Declare what ever you want inside the Linearlayout.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/header1"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="3dp"
android:choiceMode="singleChoice"
android:orientation="vertical" >
.
.
.
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:choiceMode="singleChoice" />
</LinearLayout>
</ScrollView>