
Android问题总结
总结android开发过程及IDE使用中遇到的问题及解决方案!
月盡天明
Hope is a good thing,maybe the best of things!
展开
-
Android 开发 Tip 18 -- PopupWindow 在 Android N(7.0)及以上 的兼容性问题
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937http://www.jianshu.com/p/0df10893bf5bhttp://www.jianshu.com/p/825d1cc9fa79http://blog.youkuaiyun.com/jabony/article/details/69520686 http://blo原创 2017-08-29 13:53:22 · 1181 阅读 · 0 评论 -
Android 开发 Tip 17 -- 为什么getBackground().setAlpha(); 会影响别的控件?
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937http://www.jb51.net/article/110035.htmhttps://mp.weixin.qq.com/s?__biz=MzA3NTYzODYzMg==&mid=2653578233&idx=1&sn=aea773c1e815fdef910fba28d7原创 2017-07-21 18:25:00 · 935 阅读 · 0 评论 -
Android 开发 Tip 16 -- setMultiChoiceItems & setSingleChoiceItems 不显示!?
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937原创 2017-06-14 19:06:25 · 1388 阅读 · 0 评论 -
Android 开发 Tip 15 -- can be replaced by one <TextView/> and a compound drawable
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937 This tag and its children can be replaced by one <TextView/> and a compound drawable当xml布局文件中,出现两个紧挨着的 <ImageView /> <TextView />,IDE就会原创 2017-05-19 13:23:45 · 1363 阅读 · 0 评论 -
Android 开发 Tip 14 -- Singleton
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937package android.util.Singleton.javapublic abstract class Singleton<T> { private T mInstance; protected abstract T create(); publ原创 2017-05-17 10:18:07 · 1130 阅读 · 0 评论 -
Android 开发 Tip 13 -- generateViewId
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937View.javapublic static int generateViewId() { for (;;) { final int result = sNextGeneratedId.get(); // aap原创 2017-05-15 11:45:12 · 2423 阅读 · 0 评论 -
Android 开发 Tip 12 -- 各种Drawable
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937原创 2017-05-12 11:19:23 · 999 阅读 · 0 评论 -
Android 开发 Tip 11 -- TabLayout 设置文字大小一致
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/71425135 使用TabLayout的时候,有些tab的文字比较多时,会出现与其他tab的文字大小不一致的情况!TabLayout 继承自 HorizontalScrollView内部有几个关键的类:SlidingTabStrip – TabLayout的唯一子ViewTab原创 2017-05-08 17:00:55 · 10329 阅读 · 0 评论 -
Android 开发 Tip 10 -- app:showAsAction & android:showAsAction
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937IDE给出的提示:所以当Activity继承AppCompatActivity 时,应该用app:showAsActionActivity继承Activity时,应该使用android:showAsAction原创 2017-05-04 14:52:05 · 996 阅读 · 0 评论 -
Android 开发 Tip 9 -- TouchDelegate
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/71115773View的 onTouchEvent() 函数中有这样一段!public boolean onTouchEvent(MotionEvent event) { // ... if (mTouchDelegate != null) {原创 2017-05-03 12:24:17 · 1144 阅读 · 0 评论 -
Android 开发 Tip 8 -- clipToPadding & clipChildren
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51471280最常用这两个属性的场景是这样的:ListView或者RecyclerView可以透过透明(半透明)的actionbar或者toolbar被用户看到!<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:and原创 2017-05-03 10:32:28 · 1322 阅读 · 0 评论 -
Android 开发 Tip 7 -- volatile & synchronized
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51471280volatile只能用于修饰变量,而synchronized可以修饰方法和代码块多线程访问volatile不会发生阻塞,而synchronized会发生阻塞volatile只能保证数据可见性,不能保证原子性!synchronized可以保证原子性,也可以间接保证可见性原创 2017-05-01 15:05:58 · 846 阅读 · 0 评论 -
Android 开发 Tip 6 -- Spinner 文字 & icon 居中显示
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/70903974设置Spinner 文字居中默认情况下,Spinner控件的效果是这样的: 想让文字居中显示怎么办???在布局文件中设置android:gravity="center"也不起作用!!源码走读先来看 Spinner 的构造函数public Spinner(Context原创 2017-04-28 13:12:23 · 13619 阅读 · 5 评论 -
Android 开发 Tip 5 -- View xxx not attached to window manager
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51471280错误信息java.lang.IllegalArgumentException: View=DecorView@f4179d7[title] not attached to window managerat android.view.WindowManagerGlobal.f原创 2017-04-16 13:22:28 · 3174 阅读 · 0 评论 -
Android 开发 Tip 4 -- You must call removeView() on the child's parent first
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51471280问题描述:Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's paren原创 2017-04-15 23:43:50 · 4223 阅读 · 0 评论 -
Android 开发 Tip 3 -- that was originally added here
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51471280窗体句柄泄漏异常信息如下:xxx has leaked window DecorView@ffd62e7[title] that was originally added here这类错误一般都是在使用AlertDialog , PopupWindow, ProgressD原创 2017-04-15 18:06:48 · 7212 阅读 · 0 评论 -
Android 开发 Tip 2 -- 多主题下drawable.xml使用?attr的问题
转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51820937多主题下引用attr的问题。在5.0以下手机,如果drawable xml文件中引用了attr ,则会出现类似下面的错误04-14 14:43:06.413: W/System.err(13850): java.lang.RuntimeException: Unable t原创 2017-04-14 16:31:28 · 2043 阅读 · 0 评论 -
Android 开发 Tip 1 -- android:state_checked & android:state_activated
使用RadioButton时,如果需要自定义样式,则要注意使用 android:state_checked 这个属性。举个例子:一个选择性别的RadioGroup:<RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:la原创 2017-04-14 16:20:32 · 2378 阅读 · 0 评论