import android.widget.EditText;import android.widget.ImageButton;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.PopupWindow;import android.widget.RadioButton;import android.widget.RadioGroup;import android.widget.RelativeLayout;import android.widget.SeekBar;import android.widget.CompoundButton.OnCheckedChangeListener;import android.widget.SeekBar.OnSeekBarChangeListener;import android.widget.TextView;import android.widget.Toast;import android.widget.ViewSwitcher;
|
Related Methods |
Description |
|
|
|
|
|
|
|
|
|
|
|
|
|
SetVilibility (int) |
Set whether the component is visible |
|
|
| Android: layout_height |
Height of the Child widget Layout |
| Android: layout_width |
Specify the layout width of the Child widget. |
android:layout_width="fill_parent"android:layout_height="wrap_content"
XML attributesRelated MethodsDescriptionAndroid: layout_marginBottomSetMargins (int, int)The margin of the Child widget.Android: layout_marginLeftSetMargins (int, int)The margin on the left of the Child widget.Android: layout_marginRightSetMargins (int, int)The margin on the Right of the Child widget.Android: layout_marginTopSetMargins (int, int)The margin above the child widget.
android:layout_marginTop="10dp" android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:layout_marginBottom="10dp"
<TextView android: id = "@ + id/show_helloworld" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "I implemented the XML layout file" android: textColor = "@ color/LightOrange"/>
setContentView(R.layout.main);
private Text showText;
showText = (Text) findViewById(R.id.show_helloworld);
// Create a linear layout manager LinearLayout layout = new LinearLayout (this); // set anctilayout to display layoutsuper. setContentView (layout); layout. setOrientation (LinearLayout. VERTICAL); // create a TextViewfinal TextView textView = new TextView (this); textView. setText ("I implemented it through java code ...... "); Layout. addView (textView );In the MainActivity class, call:
showText = (Button) findViewById(R.id.show_helloworld);showText.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubIntent intent = new Intent(MainActivity.this,JavaActivity.class);startActivity(intent);}});