摘要: 一:工作线程中的回掉更新UI 可以看到5s后报错了:Only the original thread that created a view hierarchy can touch its views. 二:改造2,在线程里切换到UI线程回掉 这样是可行的,没报错。直接在Callback中改也可以: 阅读全文
posted @ 2016-04-14 13:37 bvin 阅读(1125) 评论(0) 推荐(0) 编辑
摘要: 外面是一层RelativeLayout,前面的text和后面按钮都是设置centerParent_vertical,第二个hello是需要与第一个底部对齐,虽然设置alginBottom指向第一个hello,但实际上如上图所示并没有达到效果。 原因是因为外层Layout的高度设置的是wrap_con 阅读全文
posted @ 2016-04-14 12:21 bvin 阅读(3827) 评论(0) 推荐(0) 编辑
摘要: 一:TextView的onDraw()方法: 1.第一句restartMarqueeIfNeeded()绘制字幕滚动。 首先我们看一个东西: android.text.TextUtils.java 很熟悉对不对,这就是平常在TextView的android:ellipsize属性,当字符显示不下的时 阅读全文
posted @ 2016-04-09 01:24 bvin 阅读(10590) 评论(0) 推荐(0) 编辑
摘要: 前段时间接到一个需求,要求GridView超过两行只显示两行多余的不显示。但是GridView没有设置多少行的api,只有设置多少列的方法,到处查找资料都类似的case,stakeoverfrow上面也没什么有价值的答案,不过在百度知道竟然看到了一个思路。 知道:http://zhidao.baid 阅读全文
posted @ 2016-04-01 11:05 bvin 阅读(8946) 评论(0) 推荐(2) 编辑
摘要: 如图所示,要实现这一的需求,一般人的布局方式就是左边一button,右边一button,中间一个EditText,为了输入框的响应触摸范围更大往往不会把宽度设置为wrap_content,要么设置成match_parent/fill_parent要么给定个minWidth+wrap_content。... 阅读全文
posted @ 2015-12-30 16:11 bvin 阅读(17580) 评论(0) 推荐(0) 编辑
摘要: private static class Visible extends Handler implements UpdateLayout, Runnable{ public Visible(Spannable sp, PasswordTransformationMethod ptm)... 阅读全文
posted @ 2015-12-24 16:36 bvin 阅读(3086) 评论(0) 推荐(0) 编辑
摘要: /** Called when the user clicks the Send button */public void sendMessage(View view) { // Do something in response to button}In order for the system ... 阅读全文
posted @ 2015-11-30 15:53 bvin 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 在我们看来两者效果都是一样的,其实看下源码就知道cancel肯定会去调dismiss的,如果调用的cancel的话就可以监听DialogInterface.OnCancelListener。/** * Cancel the dialog. This is essentially the s... 阅读全文
posted @ 2015-08-05 17:41 bvin 阅读(15599) 评论(0) 推荐(2) 编辑
摘要: 阅读全文
posted @ 2015-06-22 20:01 bvin 阅读(5529) 评论(0) 推荐(0) 编辑
摘要: 代码就这么一段:new AlertDialog.Builder(getApplicationContext(),R.style.MyAlertDialogStyle) .setTitle("温柔") .setMessage("不知道 不明了 不想要\n" + ... 阅读全文
posted @ 2015-06-21 17:55 bvin 阅读(1087) 评论(0) 推荐(0) 编辑