Структура «список» из программно:Android (Programmatic) раскладка не показывая 2-ой TextView, когда упаковка 1rst TextView
ScrollView
->LinearLayout (itemRow)
-->LinearLayout (itemTitle)
--->TextView (title)
--->TextView (price)
--> (other layouts)...
... and start again with itemRow
Когда текст название TextView правильно завернуты, цена (бесплатно) является не показано.
Код:
LayoutParams p=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT);
TextView title=new TextView(ctx);
title.setText(e.getTitle());
title.setTextAppearance(ctx, R.style.eList_Title);
TextView price=new TextView(ctx);
price.setPadding(2, 1, 1, 1);
price.setSingleLine(true);
if (e.getPrice().doubleValue()==0) {
price.setText('('+getString(R.string.e_free)+')');
price.setTextColor(colorGreenFree);
} else {
price.setText('('+NumberFormat.getCurrencyInstance().format(e.getPrice())+')');
price.setTextColor(Color.RED);
}
LinearLayout llTitle=new LinearLayout(ctx);
llTitle.setBackgroundResource(R.drawable.gradient_silver_red);
llTitle.setLayoutParams(llpMatchParentWrapContent);
llTitle.addView(title);
llTitle.addView(price);
Примечание: если price.setSingleLine (истина); удаляется я получаю этот результат:
P.D .: Я попытался с RelativeLayout, и имеют те же проблемы.
Почему бы вам не попробовать с Listview путем реализации пользовательского макета для ListView. Как это http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html – GrIsHu