działalność, można utworzyć LinearLayout programowo w następujący sposób:Jak programowo utworzyć niestandardowy układ widoku?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
ll.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
TextView tv1 = new TextView(this);
tv1.setText("HELLO");
ll.addView(tv1);
TextView tv2 = new TextView(this);
tv2.setText("WORLD");
ll.addView(tv2);
setContentView(ll);
}
Jak zrobić to samo wewnątrz Widok niestandardowy podklasy? Brak setContentView
lub onCreate
metody ...
może być [ten jeden] (http://stackoverflow.com/questions/14054197/how-to-get-na-nazwisko-tekstview-included-in-linear-layout-in-onclicklistener) –
refer ten link http://stackoverflow.com/questions/14081339/how-can-i-declare-textview-as-global-variable-to-use-in-other-class/14081472#14081472 –