Android 小 tips 合集 (不断补充)

recyclerview 代替 listview

http://blog.csdn.net/lmj623565791/article/details/45059587


Android 点击Home键后再点击APP图标,APP重启而不是回到原来界面

http://blog.csdn.net/guozikai/article/details/54932467


解决在onCreate()过程中获取View的width和Height为0的4种方法

监听Draw/Layout事件:ViewTreeObserver
将一个runnable添加到Layout队列中:View.post()

http://www.cnblogs.com/kissazi2/p/4133927.html


PopupWindow点击事件

我工程中需要支持内外点击事件都能响应,是这么设置的:

this.setTouchable(true);
this.setFocusable(false);
this.setOutsideTouchable(false);

this.setTouchInterceptor(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return false;
    }
});


Activity的四种launchMode

http://blog.csdn.net/liuhe688/article/details/6754323/


addview 添加动画

https://stackoverflow.com/questions/23455462/cant-animate-view-that-create-from-getwindowmanager-addview

After you call WindowManager.addView you can attach a ViewTreeObserver.OnGlobalLayoutListenerto the View and use that to get the height, then use an ObjectAnimator to perform the translation. Here's an example:

mMessage.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

    @Override
    public void onGlobalLayout() {
        // Get the height of the view
        final int h = mMessage.getHeight();
        // Remove the OnGlobalLayoutListener callback
        mMessage.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        // Slide down from the top
        final ObjectAnimator oa = ObjectAnimator.ofFloat(mMessage, "translationY", -h, 0f);
        oa.setDuration(250);
        oa.start();
    }

});

java 内部静态类用法

http://www.cnblogs.com/Alex--Yang/p/3386863.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值