• Activity生命周期


    Log类对错误的排查:示例代码

    private final static String TAG = "MainActivity"; //宏定义
    Log.i(TAG,"MainActivity---->OnCreate");    //排错
    View Code

     Activity 的save保存

    宏定义:    private static final String CONTENT = "content";
    OnCreate中添加EditText的判断条件:
    txt=(EditText)findViewById(R.id.txt);
            if(null==savedInstanceState && savedInstanceState.containsKey(CONTENT)) {
                    txt.setText(savedInstanceState.getString(CONTENT));
            }
    
    创建Save函数:
        @Override
        protected void onSaveInstanceState(Bundle outState) {
            // TODO Auto-generated method stub
            super.onSaveInstanceState(outState);
            String content=txt.getText().toString();
            outState.putString(CONTENT, content);
        }
    这部分代码在虚拟机上运行会出现错误,需要一个具有android系统的手机。
    View Code

    android:theme显示连接

    android:theme="@android:style/Theme.Dialog"//显示为对话框
    android:theme="@android:style/Theme.NoTitleBar"//没有标题
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:theme="@android:style/Theme.Light.NoTitleBar"
    android:theme="@android:style/Theme.Wallpaper" 
    android:theme="@android:style/Theme.Translucent"//背景透明化
    android:theme="@android:style/Theme.Panel" //无标题背景透明化
    View Code

    在AndroidManifest.xml中新建的Activity中加入如下的一句话可以把其变成对话框的形式.

     android:theme="@android:style/Theme.Dialog"
    View Code
  • 相关阅读:
    实现FTP断点续传
    系统软件自动部署实现方案
    QT实现多语言切换
    QTreeWidget实现动态加载本地文件系统
    QuaZip实现多文件打包
    FileZilla命令行实现文件上传以及CreateProcess实现静默调用
    ctkPlugin插件系统实现项目插件式开发
    Windows与Linux下文件操作监控的实现
    QT皮肤系统的动态切换
    OpenGL 学习
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3115323.html
Copyright © 2020-2023  润新知