zoukankan      html  css  js  c++  java
  • APIDEMO阅读小结

    1、从TextView 返回的Editabel 可以是先append功能
    Editable text = (Editable)mResults.getText();
    text.append("(okay ");

    TextView 另一强大功能setError(CharSequence error) 可以设置PopUp提示,用来说明输入为空,或者错误
    重载方法setError(CharSequence error, Drawable icon);其中icon为文本框内的图标

    2、可以将Activity 的属性设置为Theme.Dialog显示任意 view
    详情可以查看CustomDialogActivity

    android:theme="@style/Theme.CustomDialog"

    <style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
    <item name="android:windowBackground">@drawable/filled_box</item>
    </style>

    <shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#f0600000"/>
    <stroke android:width="3dp" color="#ffff8080"/>
    <corners android:radius="3dp" />
    <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" />
    </shape>


    3、壁纸管理WallpaperManager
    final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
    final Drawable wallpaperDrawable = wallpaperManager.getDrawable();//获取当前的壁纸
    wallpaperDrawable.setColorFilter(mColors[mColor], PorterDuff.Mode.MULTIPLY);//过滤色

    4、半透明activity
    android:theme="@style/Theme.Translucent // 设置透明主题

    5、半透明activity +背景模糊
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    android:theme="@style/Theme.Translucent // 设置透明主题

    6、壁纸为背景
    android:theme="@style/Theme.Wallpaper" //

    7、之前Dialog无法用返回键取消是因为返回键被屏蔽了

    8、通过setType 获取文件
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("audio/*");
    startActivity(Intent.createChooser(intent, "Select music"));

    10、从xml中inflater menu
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(menuId, menu);

    11、ConditionVariable 包含 堵塞的方法

    12、修改Toast中的View的方法  devoloper 中的 Notificition Toast 有介绍 修改 Toast 位置 视图的介绍
    protected void showToast()
    {
    // create the view
    View view = inflateView(R.layout.incoming_message_panel);

    // set the text in the view
    TextView tv = (TextView) view.findViewById(R.id.message);
    tv.setText("khtx. meet u for dinner. cul8r");

    // show the toast
    Toast toast = new Toast(this);
    toast.setView(view);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.show();
    }

    private View inflateView(int resource)
    {
    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return vi.inflate(resource, null);
    }

    }

    14、继承PreferenceActivity 通过载入addPreferencesFromResource(R.xml.default_values)可以显示视图
    用来配置设置比较方便


    15、postDelayed(Runnable r, long delayMillis) 将一个Runnable加入线程队列,在一定时间后执行


    16、TextView link 的用法
    1、 使用android:autoLink="all" 属性
    2、 在String 用html格式配置URL Tel
    3、在代码中设置String 并且调用t3.setMovementMethod(LinkMovementMethod.getInstance());方法
    4、SpannableString ss = new SpannableString("text4: Click here to dial the phone.");
    ss.setSpan(new StyleSpan(Typeface.BOLD), 0, 6, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    ss.setSpan(new URLSpan("tel:4155551212"), 13, 17, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    t4.setText(ss);
    t4.setMovementMethod(LinkMovementMethod.getInstance());

    CharacterStyle 抽象类的各种子类可以实现一段TextView文本中的 部分文本的替换
    如:URLSpan可以替换URL , StyleSpan可以替换样式 , ForegroundColorSpan 可以替换文本颜色


    17、 listview 加载item时的动画 :详情参见 apiDemo--》LayoutAnimation2
    LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);//set 为animation
    ListView listView = getListView();
    listView.setLayoutAnimation(controller);

    或者使用android:layoutAnimation="@anim/layout_grid_fade"属性配置
    <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
    android:delay="0.5"
    android:animationOrder="random"
    android:animation="@anim/fade" />


    18 、Chronometer精密计算器,用来计时

  • 相关阅读:
    Linux kernel 之 uart 驱动解析
    按键驱动程序(异步通知)
    常用Linux运维命令
    进程上下文、中断上下文及原子上下文
    Linux 设备驱动开发 —— platform设备驱动应用实例解析
    C++中rapidxml用法及例子(源码)
    hpp.h与.h的区别
    使用Visual Studio扩展插件Visual assist X给代码插入注释模板
    VC++ MFC SDI/MDI Ribbon程序的停靠窗格被关闭后如何再次显示
    “ping某个IP地址,如果ping不通则在dos窗口或弹出MsgBox提示原因”的批处理bat命令
  • 原文地址:https://www.cnblogs.com/lipeil/p/2656760.html
Copyright © 2011-2022 走看看