zoukankan      html  css  js  c++  java
  • 第一行代码--笔记(3)

    AlertDialog的使用

    AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
    dialog.setTitle("This is Dialog");
    dialog.setMessage("Something important.");
    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的使用

    ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setTitle("This is ProgressDialog");
    progressDialog.setMessage("Loading...");
    progressDialog.setCancelable(true);
    progressDialog.show();

    包含住一个常用的布局......

    <include layout="@layout/title" />

    创建自定义控件

    public class TitleLayout extends LinearLayout {
        public TitleLayout(Context context, AttributeSet attrs) {
            super(context, attrs);
            LayoutInflater.from(context).inflate(R.layout.title, this);
        }
    }

    ListView的使用

    private String[] data = { "Apple", "Banana", "Orange", "Watermelon","Pear", "Grape", "Pineapple", "Strawberry", "Cherry", "Mango" };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, data);
    ListView listView = (ListView) findViewById(R.id.list_view);
    listView.setAdapter(adapter);

    目前看到书的131页,明天继续

  • 相关阅读:
    hdu6055(求正方形个数)
    树状数组模板(改点求段 / 该段求点 / 改段求段)
    poj2763(lca / RMQ + 线段树)
    poj3728(lca / tarjan离线)
    JDK8-废弃永久代(PermGen)迎来元空间(Metaspace)
    JVM垃圾回收机制
    虚拟机字节码执行引擎
    Java中程序初始化的顺序
    Java中ClassLoader浅析.
    Python中的self
  • 原文地址:https://www.cnblogs.com/tero/p/5259652.html
Copyright © 2011-2022 走看看