I am trying to make a view in a ListView (via a ListAdapter) with full width. Here is the current test code:
LinearLayout result = new LinearLayout(context); TextView testView = new TextView(context); testView.setText("Aaah"); TextView test2View = new TextView(context); test2View.setText("Eeeeh"); result.addView(testView, new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); result.addView(test2View, new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
(It should be placed in the ListAdapter createView)
Unfortunately, the two TextViews are small and both are stuck on the left. The delimiter is actually the result of the result itself, not occupying the full width, so the two text elements simply share this small space.
Does anyone know how to get them to take full width? Thank you :)
EDIT: simplified (and almost identical) problem:
Code: http://pastebin.com/6pn1hXnT
I want the TextView to be full-sized, and I will center the text so that I can see when it is full and when it only wraps the content. This code shows the text on the left, so MATCH_PARENT does nothing ...
What should I do?
Thanks!
source share