常用控件

简单的
<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();
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容