Set layout_weight=1 on the list view.
19.01.2011 3:46, Eric Crump пишет:
I need to create a preference that looks similiar like the WiFi
selection screen in the OS preferences. That screen has a ListView
that takes up the whole bottom of the screen. I have figured out how
to add a ListView using a custom preference but I can't make it take
up the remaining space. It is always just the size of a single
preference row.
@Override
protected View onCreateView(ViewGroup parent){
LinearLayout layout = new LinearLayout(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT);
layout.setOrientation(LinearLayout.VERTICAL);
list = new ListView(getContext());
list.setLayoutParams(params);
layout.addView(list);
layout.setBackgroundColor(Color.GREEN);
adapter = new ArrayAdapter<String>(getContext(),
android.R.layout.simple_list_item_1, new String[]{"abc", "def"});
list.setAdapter(adapter);
return layout;
}
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en