Android, Java, JavaScript, Linux, reading...

推荐一个Chrome浏览器翻墙插件 [置顶]


让Android网络应用启动时升级检查


Android网络应用开发中有遇到,业务接口后期调用时数据要加密传输,由于先前没在启动时升级检查,导致原来版本无法升级(只在登录后可升级),好在处于内部测试阶段。让Android网络应用启动时升级检查就可以避免上述情况发生,要点:

阅读全文 »


消除Animation残余线条


1,继承TranslateAnimation或RotateAnimation,在applyTransformation中刷新动画parentView的界面。如:

private final class MyTranslateAnimation extends TranslateAnimation {
        private View backgroundView;

        public MyTranslateAnimation(View backgroundView, int fromXType, float fromXValue, int toXType, float toXValue,
                int fromYType, float fromYValue, int toYType, float toYValue) {
            super(fromXType, fromXValue, toXType, toXValue, fromYType, fromYValue, toYType, toYValue);
            this.backgroundView = backgroundView;
        }

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            super.applyTransformation(interpolatedTime, t);
            backgroundView.postInvalidate();
        }
    }

2,调用:

TranslateAnimation cardAnimation = new MyTranslateAnimation(backgroundView, Animation.RELATIVE_TO_PARENT, 0.01f,
                Animation.RELATIVE_TO_PARENT, 0.35f, Animation.RELATIVE_TO_PARENT, 0.1f, Animation.RELATIVE_TO_PARENT,
                0.1f);
cardAnimation.setDuration(2000);
cardAnimation.setRepeatCount(Animation.INFINITE);
cardAnimation.setRepeatMode(Animation.REVERSE);
imageView.setAnimation(cardAnimation);

阅读全文 »


Android AnimationDrawable实现GIF效果动画


利用AnimationDrawable实现类似gif效果的动画:

final AnimationDrawable drawable = new AnimationDrawable();
drawable.addFrame(activity.getResources().getDrawable(R.drawable.kaiguan), 750);//添加图片帧到AnimationDrawable
drawable.addFrame(activity.getResources().getDrawable(R.drawable.kaiguan2), 1250);
drawable.setOneShot(false);//设置为循环播放
ImageView imageView = (ImageView)findViewById(R.id.imageView);
imageView.setImageDrawable(drawable);//AnimationDrawable对象给imageView
drawable.start();//动画播放
drawable.stop();//动画停止

阅读全文 »


一个鸡蛋的故事


摘自某文摘一段话:

阅读全文 »


Android startActivityForResult返回时需要注意的。


在onActivityResult中,即便是从后一个页面按back键返回的也是有resultCode的,且其值为0,其data为null.

阅读全文 »


ListView与条目显示相关问题解决


1.对一般布局如(LinearLayout)设置selector后,点击没有选中的效果,可设置其android:clickable="true" 即可。

阅读全文 »


Android Resource下图片合成(LayerDrawable)


给一个背景,背景中的一部分可变的,以下方法可以从Resouce中合成(动态改变userimg图片):

public LayerDrawable test(Context context, dynamicImg) {
    LayerDrawable layerDrawable =(LayerDrawable) context.getResources().getDrawable(R.drawable.layerlist);
    Drawable drawable = context.getResources().getDrawable(R.drawable.ic_launcher);
    layerDrawable.setDrawableByLayerId(R.id.userimage, dynamicImg);
    return layerDrawable;
}

阅读全文 »


Jekyll常用列表,标签代码


<% highlight html %>

分类(Categorys)

            <a href="/categories.html#reading">

                reading

            </a>
            <sup>[8]</sup>
        , 

            <a href="/categories.html#linux">

                linux

            </a>
            <sup>[7]</sup>
        , 

            <a href="/categories.html#embedded">

                embedded

            </a>
            <sup>[1]</sup>
        , 

            <a href="/categories.html#android">

                android

            </a>
            <sup>[35]</sup>
        , 

            <a href="/categories.html#web">

                web

            </a>
            <sup>[3]</sup>
        , 

            <a href="/categories.html#network">

            <b>network</b>

            </a>
            <sup>[7]</sup>
        , 

            <a href="/categories.html#cocos2d">

                cocos2d

            </a>
            <sup>[5]</sup>
        , 

            <a href="/categories.html#java">

                java

            </a>
            <sup>[2]</sup>
        , 

            <a href="/categories.html#git">

                git

            </a>
            <sup>[1]</sup>
        , 

            <a href="/categories.html#intellij idea">

                intellij idea

            </a>
            <sup>[1]</sup>
        , 

阅读全文 »