android部分开发摘要

Async 异步  不会阻塞当前线程
sync  同步

数据库是应用软件|结构化数据存储  JDBC  SQL

ellipsis 省略  

content provider   URI

thread--looper--messageQueue--多个message

反编译 classes.dex --> jar(dex2jar)-->jd-gui

|--List:元素是有序的(怎么存的就怎么取出来,顺序不会乱),元素可以重复(角标1上有个3,角标2上也可以有个3)因为该集合体系有索引,
  |-- ArrayList:底层的数据结构使用的是数组结构(数组长度是可变的百分之五十延长)(特点是查询很快,但增删较慢)线程不同步
  |-- LinkedList:底层的数据结构是链表结构(特点是查询较慢,增删较快)
  |-- Vector:底层是数组数据结构 线程同步(数组长度是可变的百分之百延长)(无论查询还是增删都很慢,被ArrayList替代了)

 

  mywebview.setWebViewClient(new WebViewClient() {      
      @Override      
      public boolean shouldOverrideUrlLoading(WebView view, String url)      
      {      
        view.loadUrl(url);      
        return true;      
      }      
    });    


设置全屏
1. 方法1:AndroidManifest.xml 里,Activity的 android:theme  指定为" @android :style/Theme.NoTitleBar.Fullscreen"

示例:   
<application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme=" @android :style/Theme.NoTitleBar.Fullscreen">
        <activity
            android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

 2. 方法2: 在onCreate()里指定No title
要加入:
 
      /*set it to be no title*/
      requestWindowFeature(Window.FEATURE_NO_TITLE);
       /*set it to be full screen*/
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,    
        WindowManager.LayoutParams.FLAG_FULLSCREEN);


示例:
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        /*set it to be no title*/
        requestWindowFeature(Window.FEATURE_NO_TITLE);   
         
        /*set it to be full screen*/
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,    
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
                         
        setContentView(R.layout.activity_main);


       
           //文件写入模块
        FileOutputStream fos=null;
        try {
            fos = openFileOutput("notice_list",MODE_PRIVATE);
            fos.write(data.getBytes());
        } catch (FileNotFoundException e) {
            // TODO: handle exception
            e.printStackTrace();
        } catch (IOException e) {
            // TODO 自动生成的 catch 块
            e.printStackTrace();
        }
        finally{
            if(fos != null){
                try {
                    fos.close();
                } catch (IOException e2) {
                    // TODO: handle exception
                    e2.printStackTrace();
                }
            }
        }
        

        //文件读取模块
        FileInputStream fis=null;
        byte[] buffer = null;
        try {
            fis=openFileInput("notice_list");
            buffer = new byte[fis.available()];
            fis.read(buffer);
        } catch (FileNotFoundException e) {
            // TODO: handle exception
            e.printStackTrace();
        }catch (IOException e) {
            // TODO: handle exception
            e.printStackTrace();
        }finally{
            if(fis!=null)
                try {
                    fis.close();
                } catch (IOException e2) {
                    // TODO: handle exception
                    e2.printStackTrace();
                }
        }
        String datas = new String(buffer);



       android:layout_gravity="bottom"   底部对齐
    设置权重
    android:layout_width="0dp"
        android:layout_weight="1"


[java] view plaincopy在CODE上查看代码片派生到我的代码片
//分享文字  
Intent intent = new Intent(Intent.ACTION_SEND);  
intent.putExtra(Intent.EXTRA_TEXT, "要分享的文本。");  
intent.setType("text/plain");  
startActivity(Intent.createChooser(intent, "分享"));  

[java] view plaincopy在CODE上查看代码片派生到我的代码片
//分享图片  
Uri uri = Uri.fromFile(new File("/storage/emulated/0/DCIM/Camera/img.jpg"));  
Intent intent = new Intent(Intent.ACTION_SEND);  
intent.putExtra(Intent.EXTRA_STREAM, uri);  
intent.setType("image/jpeg");  
startActivity(Intent.createChooser(intent, "分享"));  

[java] view plaincopy在CODE上查看代码片派生到我的代码片
//分享一系列图片  
ArrayList<Uri> uris = new ArrayList<>();  
uris.add(Uri.fromFile(new File("/storage/emulated/0/DCIM/Camera/img.jpg")));  
uris.add(Uri.fromFile(new File("/storage/emulated/0/DCIM/Camera/aaa.jpeg")));  
 
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);  
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);  
intent.setType("image/*");  
startActivity(Intent.createChooser(intent, "分享"));





设置actionbar背景
        this.getActionBar().setBackgroundDrawable((getResources().getDrawable(R.drawable.action_back)));

this.getActionBar().setDisplayShowCustomEnabled(true);
        this.getActionBar().setCustomView(R.layout.action_custom);
        
        
        this.getActionBar().setDisplayShowHomeEnabled(false);




让textView里面的内容水平居中,还是让textView控件在它的父布局里水平居中呢?
1. 让textView里面的内容水平居中 :    android:gravity="center_horizontal"
2. 让textView控件在它的父布局里水平居中     android:layout_gravity="center_horizontal"


BaseAdapter是一个抽象类,继承它需要实现较多的方法,所以也就具有较高的灵活性;
ArrayAdapter支持泛型操作,最为简单,只能展示一行字。
SimpleAdapter有最好的扩充性,可以自定义出各种效果。
SimpleCursorAdapter可以适用于简单的纯文字型ListView,它需要Cursor的字段和UI的id对应起来。如需要实现更复杂的UI也可以重写其他方法。可以认为是SimpleAdapter对数据库的简单结合,可以方便地把数据库的内容以列表的形式展示出来。



tabhost
layoutParam实例化布局后  可以对组件编辑 设置布局文件
设置intent新界面

原文地址:https://www.cnblogs.com/lzh-Linux/p/4434739.html