分类目录归档:Android开发
Bitmap 与 Drawable之间的转换
转换Bitmap to Drawable 1 2 Bitmap bitmap = new Bitmap (…); Drawable drawable = new BitmapDrawable(bitmap); 转换Drawable to Bitmap 1 2 Drawable d = ImagesList.get(0); Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
模拟器快捷键
F1/PgUp Menu key 菜单键 F2/PgDown Star key 星号键 F3 Call key 发送拨号键 F4 End Call key 结束通话或者说红键 Home Home key Home键 ESC Back Key 后退键 F7 Power button 电源键 F8 Disable/Enable all networking 禁止/启用所有网络 F9 Start tracing (only with -trace) … 继续阅读
Android布局属性详解
各种Layout用到的一些重要的属性: 第一类:属性值为true或false android:layout_centerHrizontal //水平居中 android:layout_centerVertical //垂直居中 android:layout_centerInparent //相对于父元素完全居中 android:layout_alignParentBottom //贴紧父元素的下边缘 android:layout_alignParentLeft //贴紧父元素的左边缘 android:layout_alignParentRight //贴紧父元素的右边缘 android:layout_alignParentTop //贴紧父元素的上边缘 android:layout_alignWithParentIfMissing //如果对应的兄弟元素找不到的话就以父元素做参照物 第二类:属性值必须为id的引用名“@id/id-name” android:layout_below 在某元素的下方 android:layout_above 在某元素的的上方 android:layout_toLeftOf 在某元素的左边 android:layout_toRightOf 在某元素的右边 android:layout_alignTop 本元素的上边缘和某元素的的上边缘对齐 android:layout_alignLeft 本元素的左边缘和某元素的的左边缘对齐 android:layout_alignBottom 本元素的下边缘和某元素的的下边缘对齐 android:layout_alignRight 本元素的右边缘和某元素的的右边缘对齐 第三类:属性值为具体的像素值,如30dip,40px android:layout_marginBottom 离某元素底边缘的距离 android:layout_marginLeft 离某元素左边缘的距离 … 继续阅读
Android 各国语言缩写-各国语言简称
android资源文件夹的写法规则: 语言缩写-国家地区缩写 语言缩写请参阅: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm en 英文 en_US 英文 (美国) ar 阿拉伯文 ar_AE 阿拉伯文 (阿拉伯联合酋长国) ar_BH 阿拉伯文 (巴林) ar_DZ 阿拉伯文 (阿尔及利亚) ar_EG 阿拉伯文 (埃及) ar_IQ 阿拉伯文 (伊拉克) ar_JO 阿拉伯文 (约旦) ar_KW 阿拉伯文 (科威特) ar_LB 阿拉伯文 (黎巴嫩) ar_LY 阿拉伯文 (利比亚) ar_MA 阿拉伯文 … 继续阅读
获取SD卡和手机存储空间
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 … 继续阅读
“Copy” did not complete normally. Please see the log for more information.
在用android日志的时候总是弹出一个Problem Occurred错误提示窗口, 内容为:”Copy” did not complete normally. Please see the log for more information. Reason:Argument not valid 我用的是有道词典,退出有道词典或者关闭划词翻译就可以了。 如果是其他的翻译工具,关闭划词翻译功能。
Android中attr自定义属性详解
首先在你需要使用自定义属性的布局文件中定义标签,当然也可以使用系统默认标签android: 1 2 3 4 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:zkx=http://schemas.android.com/apk/res/com.zkx.test android:orientation="vertical" android:layout_width="fill_parent"; android:layout_height="wrap_content"> 第二行是自定义标签。 格式如上,其中“xmlns:zkx”冒号后面是标签名,在下面使用时(只对当前文件可用) 1 <TextView zkx:属性名/> “com.zkx.test”是你的工程包名。 一、reference:参考指定Theme中资源ID。 1.定义: 1 2 3 <declare-styleable name="My"> <attr name="label" format="reference" > </declare-styleable> 2.使用: 1 <Buttonzkx:label="@string/label" > 二、Color:颜色 1.定义: 1 2 3 <declare-styleable name="My"> … 继续阅读