private LinearLayout getRowView(Item item) { LinearLayout wrapper = new LinearLayout(getContext()); LinearLayout rowLayout = new LinearLayout(getContext()); int textStyle = item.hasShortDesc() ? Typeface.BOLD : Typeface.NORMAL; TextView textView = util.createTamilTextView(0xFF000000, 18, textStyle); textView.setText(item.getText()); textView.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1)); rowLayout.addView(textView); if (!item.getChildren().isEmpty()) { TextView arrow = util.createTamilTextView(0xFF000000, 18, Typeface.NORMAL); arrow.setText(">"); rowLayout.addView(arrow); wrapper.setOnClickListener(getClickListener()); wrapper.setOnTouchListener(getHighlightListener()); } wrapper.setOrientation(LinearLayout.VERTICAL); setRowStyle(wrapper); wrapper.setTag(item); wrapper.addView(rowLayout); if (item.hasShortDesc()) { TextView desc = util.createTamilTextView(0xFF000000, 14, Typeface.NORMAL); desc.setText(item.getShortDesc()); wrapper.addView(desc); } return wrapper; }
public void someMethod(Item item) { setTag(item); table.removeAllViews(); scrollView.scrollTo(0, 0); header.render(item); for (Item child : item.getChildren()) { table.addView(getRowView(child)); } }