常用控件

简单的
<TextView 
        android:id="@+id/tv_tv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Hello World!"
        android:textColor="#00ff00"
        android:textSize="24sp" />
<Button
        android:id="@+id/bt_bt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />
<EditText
        android:id="@+id/et_et"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="asdfg"
        android:maxLines="2" />
<ImageView
        android:id="@+id/iv_iv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher" />
  <ProgressBar
        android:id="@+id/pb_pb"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:max="100" />
难点的
AlertDialog.Builder dialog=new AlertDialog.Builder(TestActivity.this);
                dialog.setTitle("This is Dialog");
                dialog.setMessage("Somnus");
                dialog.setCancelable(false);//可否取消
                dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });
                dialog.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });
                dialog.show();
 
ProgressDialog progresDialog=new ProgressDialog(TestActivity.this);
                progresDialog.setTitle("sdf");
                progresDialog.setMessage("Lading.....");
                progresDialog.setCancelable(true);
                progresDialog.show();

推荐阅读更多精彩内容