Button:
java:
Button button = (Button ) findViewById(R.id.button );
button.setOnClickListener(new View.OnClickListener() {@Override public void onClick(View view) { ///perform your code inside} });Xml:<Button
android:id="@+id/button"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="Button" />Textview:java:TextView textview = (TextView ) findViewById(R.id.textview );textview.setText("your label text");Xml:<TextView
android:id="@+id/textview"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="TextView" />EditText:java:EditText edittext= (EditText ) findViewById(R.id.edittext);edittext.setText("your label text");
String getText=edittext.getText().toString();Xml:<EditText
android:id="@+id/edittext"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="EditText" />
more matirial UI components:
No comments:
Post a Comment