andorid

作者: ReanCool | 来源:发表于2016-11-21 16:23 被阅读27次

2016.8.12


2.xml tool的使用

 tools:text”@string” 

在设计时你会看到 TextView 中的文字,而在运行时将不会有该属性存在。

tool的属性,就是预览时和运行时,有差距就
可以同时使用 android 和 tools 命名空间。tools 命名空间将会用在设计阶段,而前者会用在运行时。
有时你希望在运行时开启某些特性,而在设计预览时关闭它
同时写了

android:fastScrollAlwaysVisible
tools:fastScrollAlwaysVisible
:在运行时开启了 fastScrollAlwaysVisible 功能,而在设计时关闭了它。

在 XML 中设置 Target API

tools:locales=“es” 告知 Lint 你本地化资源的技巧:

tools:layout=
预览 fragment 和自定义View的布局

使用了 tools:layout 属性来预览 一个@layout/**** 布局而   不用将工程运行在设备或模拟器上

tools:listitem

在item中还可以使用这个来预览item的layout内容
需要在recycleview中加入这个属性tools:listitem =@layout/****item的layout

tools:showIn=”@layout/***

假如你有一个自定义View,或可重用的布局会通过标签被用在许多地方。当设计该View时,在想要包含它的父容器中预览它会如何显示,将会很有帮助。

3.shrinking的理解

这里主要说,有些资源,要keep因为比如一个图标我只是在drawable23使用,他的版本的用另外一个图片,但是当我使用shrinking的时候回吧我这个drawbale23的资源移出。这时候就要使用这个keep了来看看官方文档怎么说的吧。
https://developer.android.com/studio/build/shrink-code.html

If there are specific resources you wish to keep or discard, create an XML file in your project with a <resources> tag and specify each resource to keep in the tools:keep attribute and each resource to discard in the tools:discard attribute. Both attributes accept a comma-separated list of resource names. You can use the asterisk character as a wild card.

For example:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/l_used*_c,@layout/l_used_a,@layout/l_used_b*"
tools:discard="@layout/unused2" />

还有shrinkMode="strict"这个暂时不理解作用


3.scrollviw 内嵌

一个个是,内嵌数据更新时,scrollview会自动滚动到更新的内容,这个有些是有不好,就要设置内嵌内容 setFocusable(false)

比如内嵌一个RecyclerView, 不设置的话很麻烦,聊天那种情景可以使用

 scrollView.fullScroll(ScrollView.FOCUS_DOWN);  
 scrollTo

来滚动到头尾
http://blog.csdn.net/t12x3456/article/details/12799825

Focusable

menuRecycle.setFocusable(false);
完美解决更新时滚动

http://blog.csdn.net/icyfox_bupt/article/details/15026299


2016.8.15

1.checkbox和radiobutton的差别
RadioButton和CheckBox的区别:

1、单个RadioButton在选中后,通过点击无法变为未选中 
      单个CheckBox在选中后,通过点击可以变为未选中
2、一组RadioButton,只能同时选中一个
      一组CheckBox,能同时选中多个
3、RadioButton在大部分UI框架中默认都以圆形表示
      CheckBox在大部分UI框架中默认都以矩形表示

2016.8.16

1.对BroadcastReceiver的更深一层理解
http://blog.csdn.net/dongge825/article/details/39290813
intent action的几种

Intent.ACTION_BOOT_COMPLETED //系统启动完成
Intent.ACTION_MEDIA_MOUNTED //SD卡挂载
Intent.ACTION_MEDIA_UNMOUNTED //SD卡卸载
Intent.ACTION_USER_PRESENT//解除锁屏
ConnectivityManager.CONNECTIVITY_ACTION//网络状态变化

动态广播:
只能在代码中注册,程序适应系统变化做操作,程序运行状态才能接收到
Intent.ACTION_SCREEN_ON //屏幕亮
Intent.ACTION_SCREEN_OFF //屏幕灭
Intent.ACTION_TIME_TICK //时间变化  每分钟一次   

2016.8.30

1.弹出对话框

<a href="http://jingyan.baidu.com/article/c275f6bac9813be33d7567f1.html">弹出对话框</a>

一、布局中软键盘自动弹出

bargain_dialog_offer_edit.requestFocus();

bargain_dialog_offer_edit.setFocusable(true);

InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

imm.showSoftInputFromInputMethod(bargain_dialog_offer_edit.getWindowToken(),0);

二、布局中软键盘自动关闭

InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(talking_edit.getWindowToken() , 0);

三、对话框中软键盘自动弹出和关闭

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

<b>实际上 在dialog中并不好用</b>

2.Android 判断当前Activity是不是最后一个Activity 以及 应用或Activity是否存在
http://blog.csdn.net/u014649598/article/details/46357539

2016.9.1

VIEW OutsideViewListener

http://stackoverflow.com/questions/25592438/check-click-outside-of-view

2016.9.6

  1. 安卓6.0权限问题,以及权限二次提醒

    <a href="http://blog.csdn.net/hudashi/article/details/50775180">比较详细的文章</a>

    给出了比较好的结局方案

  2. AlertDialog.Builder 详解
    title,massage,setSingleChoiceItems,setPositiveButton,setNegativeButton
    <a href="http://blog.csdn.net/weiyidemaomao/article/details/7861723"> AlertDialog.Builder </a>

  1. 代码中设置margin

android 使用代码实现 RelativeLayout布局
http://kukuqiu.iteye.com/blog/1018396

 RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,                        LinearLayout.LayoutParams.WRAP_CONTENT));                lp.addRule(RelativeLayout.BELOW,R.id.menu_scroll);
            lp.setMargins(0, 0, 0, 55);
            menuScroll.setLayoutParams(lp);

2016.9.12

  1. 在app里面修改系统语言

http://blog.csdn.net/scyatcs/article/details/49978797

https://github.com/JackCho/SwitchLanguageDemo/blob/master/src/com/jit/language/BaseActivity.java
存一下。有了修改

  1. When dialog.setCanceledOnTouchOutside(true); then you just override onCancel() like this:

mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
dialog.dismiss();
if(context instanceof Activity){
((Activity)context).finish();
}
}
});

Type your code inside the onCancel() method so it runs when the dialog gets canceled.

2016.10.6

  1. andriod 图片灰度

    ColorMatrix中setSaturation
    Set the matrix to affect the saturation of colors. A value of 0 maps the color to gray-scale. 1 is identity.
    <a href="http://www.codes51.com/article/detail_129596.html">灰度设置 </a>
    2.view alpha
    0.0f和1.0f之间,0.0f完全不暗,1.0f全暗

2016.11.14

textview 滚动条一直显示
mContentTeacherAdapterTv.setMovementMethod(ScrollingMovementMethod.getInstance());
// 注意如果想要滚动条时刻显示, 必须加上以下语句:
mContentTeacherAdapterTv.setScrollbarFadingEnabled(false);

textview 指定大小 变色


完美的方法动态计算,解决 国际化字节变化

http://www.jb51.net/article/76278.htm

局部变色
局部变大

http://blog.csdn.net/qq_29988575/article/details/50419483


还有一种是 用html 不用说多了国际话的时候注意用转义

<![CDATA[ ***内容***]]>

<string name="welcome_info_2">        <![CDATA[  
    欢迎你,<font color="#c5663e">%s</font>  
    ]]>  
</string>

相关文章

  • 史上最全Websocket通信测试

    H5和H5之间通信 H5和Andorid之间通信 Andorid和Andorid之间通信 H5通过http协议调用...

  • NDK开发基本常识

    重要的事情说3遍 请使用 Andorid Studio 2.2 及以上版本! 请使用 Andorid Studio...

  • andorid

    2016.8.12 2.xml tool的使用 在设计时你会看到 TextView 中的文字,而在运行时将不会有该...

  • 物联网体系介绍三:常见的开源操作系统

    1、Andorid Things Andorid Things 是谷歌上周刚推出的物联网操作系统,是去年推出的“B...

  • Android 第十天

    到今天为止,Andorid上的基本控件已经全部学完啦,加油。 Andorid 事件 三个概念涉及到Android事...

  • andorid | adb

    oh no ? -> adb command not found /library/andorid/platorm...

  • android源码中编译APK

    andorid源码中编译apk,代码中引入新的包编译不过,需要在andorid.mk中添加相对应的包使用过程参考源...

  • 启动流程

    https://juejin.cn/post/6946581970960793613 在Andorid Frame...

  • yuv420p 转rgb计算

    andorid 时间 compute shader链接:https://gitee.com/1392492818/...

  • andorid课

    我爱学习,android使我快乐

网友评论

      本文标题:andorid

      本文链接:https://www.haomeiwen.com/subject/rrpupttx.html