张颜峰
zhangyf1987hb · 共 61 篇文章
android中TextView实现单行跑马灯
最近为了解决某个bug,textview中内容过长的话自动换行,但是调用measureText函数时发现返回值很不准确,单位也不确定,是pixel还是dip,都不准。后来想起textview中有个内容过长加省略号的属性,即ellipsize,可以较偷懒地解决这个问题,哈哈~ 用法如下: 在xml中 android:ellipsize = "end" 省略号在结尾 android:ellipsize = "start" 省略号在开头 android:ellipsize = "middle" 省略号在中间 android:ellipsize = "marquee" 跑马灯 最好加一个约束andr…
2013-01-31 13:57 · Android · 评论(0) · Android · TextView · 跑马灯
雾霾天气戴什么样的口罩才管用
雾霾天气,最好佩戴口罩外出。普通、灭菌、棉布、活性炭口罩,再加上这些天在网上商城热销的N95、KN90型口罩,现在市面上有各式各样的口罩产品,那么如何选择合适的口罩呢? 雾霾天气戴什么样的口罩才管用 医生建议,雾霾天气,普通人更适合佩戴KN90型口罩。那么,啥叫N95、KN90型口罩?专业人士介绍,如果口罩对小于2.5微米颗粒的捕获能力为90%,则为KN90,如果捕获能力为95%,则为N95。对于这种大的雾霾天气,普通棉布口罩基本不起防护作用;N95虽能过滤95%的PM2.5,但其密闭严、透气性差。 医生提醒,佩戴N95这种专业防护型口罩要经过培训,否则容易造成呼吸困难。对于特殊人群,比如儿…
2013-01-30 12:29 · 生活常识 · 评论(0) · 工作 · 生活
android 自定义(画)View
Android教程中自定义View的学习,对于初学着来说,他们习惯了Android传统的页面布局方式,如下代码: 01 <?xml version="1.0" encoding="utf-8"?> 02 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 03 android:orientation="vertical" 04 android:layout_width="fill_parent" 05 android:layout_height="fill_parent" 06 > 07 <Text…
2013-01-29 11:37 · Android · 评论(0) · Android · 自定义view
Android 机型适配之屏幕适配
Supporting Different Screens PREVIOUS NEXT THIS LESSON TEACHES YOU TO Create Different Layouts Create Different Bitmaps YOU SHOULD ALSO READ Designing for Multiple Screens Supporting Multiple Screens Iconography design guide Android categorizes device screens using two general properties: size and …
2013-01-29 10:53 · Android · 评论(0) · Android · 屏幕适配
Android 机型适配之本地化
Supporting Different Languages PREVIOUS NEXT THIS CLASS TEACHES YOU TO Create Locale Directories and String Files Use the String Resources YOU SHOULD ALSO READ Localization It’s always a good practice to extract UI strings from your app code and keep them in an external file. Android makes this eas…
2013-01-29 10:50 · Android · 评论(0) · Android · 本地化 · localization
android TextView 阴影效果,和使用style学习
[xhtml] view plain copy <TextView android:id="@+id/tvText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text1" android:textSize="28sp" android:textStyle="bold" android:textColor="#FFFFFF" android:shadowColor="#ff000000" android:shadowDx="2" android:shadowD…
2013-01-28 16:15 · Android · 评论(0) · Android · TextView · style
Loader 详解
Loaders IN THIS DOCUMENT Loader API Summary Using Loaders in an Application Starting a Loader Restarting a Loader Using the LoaderManager Callbacks Example More Examples KEY CLASSES LoaderManager Loader RELATED SAMPLES LoaderCursor LoaderThrottle Introduced in Android 3.0, loaders make it easy to a…
2013-01-28 11:39 · Android · 评论(0) · Android · 异步加载 · loader · 数据加载
Frament 详解
Fragments QUICKVIEW Fragments decompose application functionality and UI into reusable modules Add multiple fragments to a screen to avoid switching activities Fragments have their own lifecycle, state, and back stack Fragments require API Level 11 or greater IN THIS DOCUMENT Design Philosophy Crea…
2013-01-28 11:07 · Android · 评论(0) · UI · Android · fragment
android 录入界面设计标准
Devices vary not only in physical size, but also in screen density (DPI). To simplify the way you design for multiple screens, think of each device as falling into a particular size bucket and density bucket. The size buckets are handset (smaller than 600dp) and tablet (larger than or equal 600dp).…
2013-01-25 19:13 · Android · 评论(0) · UI · Android
android 实现Iphone效果Switch,
很多人想做一个和iphone的,其实很简单 但是很多人问 主要是修改样式和图标就好了 Xml代码 <ToggleButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/toggle_me"/> <selector xmlns:android="http://schemas.android.com/apk/res/android"> Xml代码 <item android:state_checked="true" android:d…
2013-01-25 16:55 · Android · 评论(0) · Android · switch · togglebutton
不错的设计素材
Minimal retro arcade button Buttons Clear modern web button Buttons Walkie talkie button Buttons Tasty web button Buttons Instagram button Buttons Tron style radio buttons Buttons Stainless steel love button Buttons Simple clean push button Buttons Wooden button Buttons [App store Jigsaw Button](ht…
2013-01-24 18:58 · 素材 · 评论(0) · Button · 素材
android 9.png 制作原理
一、什么是9.png: 可能做过任务栏美化的同学都会知道,我靠,framework-res.apk\res\drawable-hdpi 目录下有非常非常多的XXXXXX.9.png图片。 千万不要以为这个9只是png格式图片的命名区分,其实他是一种特殊的格式,在png图片的基础上动了些手脚,而且这种手脚你会 看不见摸不着(详情见下面具体内容)。 9.png格式的图片是安卓平台上新创的一种被拉伸却不失真的玩意(挺高级的吧),也许有 的同学在做美化的时候很喜欢一个图片素材,重命名替换了drawable-hdpi下的素材,但是运行系统后发现,怎么被拉伸得不像样子 了,哈哈,这就是9.png图片不能…
2013-01-24 17:17 · Android · 评论(0)
Android Looper和Handler
Android Looper和Handler Message:消息,其中包含了消息ID,消息处理对象以及处理的数据等,由MessageQueue统一列队,终由Handler处理。 Handler:处理者,负责Message的发送及处理。使用Handler时,需要实现handleMessage(Message msg)方法来对特定的Message进行处理,例如更新UI等。 MessageQueue:消息队列,用来存放Handler发送过来的消息,并按照FIFO规则执行。当然,存放Message并非实际意义的保存,而是将Message以链表的方式串联起来的,等待Looper的抽取。 Looper…
2013-01-24 16:54 · Android · 评论(0) · Handler · Looper · messagequeue · 进程间通信
android 单选框实现
Radio.java [java] view plain copy package archie.android.activity; import android.app.Activity; import android.os.Bundle; import android.view.Gravity; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; public class Radio…
2013-01-24 16:44 · Android · 评论(0) · RadioGroup
Theme Holo
1、Theme_Holo 意思为:New Honeycomb全屏显示样式,默认是黑背景, api原文: New Honeycomb holographic theme. Dark version. The widgets in the holographic theme are translucent on their brackground, so applications must ensure that any background they use with this theme is itself dark; otherwise, it will be difficult to s…
2013-01-24 14:56 · Android · 评论(0) · Android · 主题