I need to put a ListView in a custom preference. It needs to look similiar to the WiFi settings in the OS preferences. My problem is I am unable to make it take fill the space. It only takes up the space given to a normal preferece item. How do I make the LinearLayout I return from onCreateView take up the remainder of the height?
@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; } Sorry for a repost. My original post seems to have disappeared. -- 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