Categories
Android

Android播放gif格式图片

关于gif的播放,Android ApiDemos给出一个实例: ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.java 小的gif图片用Movie播放还行,大一点的就搞不定了。官方文档说不推荐使用gif格式的。解析gif要占很大的内存,不过你可以把gif分解成N张png格式的,用AnimationDrawable来播放。在MTK,展信平台上,一些连续动画的游戏,也是采用这样样的方法,分解gif为N多个Frame,做过Flash的网页设计师应该是很熟悉了。 在res/anim目录下创建相应的xml文件,举个例子: girl_kiss.xml: <?xml version=”1.0″ encoding=”UTF-8″?> <animation-list xmlns:android=”http://schemas.android.com/apk/res/android” android:oneshot=”true” android:visible=”true”> <item android:drawable=”@drawable/kiss_frame00_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame01_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame02_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame03_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame04_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame05_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame06_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame07_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame08_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame09_160ms” android:duration=”160″ /> <item android:drawable=”@drawable/kiss_frame10_160ms” […]

Categories
Android

android 字符串格式化

发现没啥好写的,提供个链接吧,查阅方便。 一般用到 String.format与Html.fromHtml 官方上有详细介绍: http://developer.android.com/guide/topics/resources/string-resource.html 有段时间看了日历的代码,发现Plurals有 xliff 字样,搜索一下,小日本写的 http://linkyou-blog.blogspot.com/2010/02/previously-on-my-last-blog.html 终于弄明白了。 读一些代码,发现string.xml里还发现一些蛮有用的技巧,直接写Unicode码: 用 \u0020 表示空格。 用 \u2026 表示省略号。 android提供的android.text.format 也很有用,比如 Formatter 提供的 public static String formatFileSize(Context context, long number) 就很好用,很多人估计是不知道,自个儿写了这样的函数,重复造车轮。

Categories
Android

Android 反编译中的 $assertionsDisabled

很久以前看了一些apk经过反编译后得到的 .dex 格式文件,发现有assertionsDisabled, 不解记录之,今天翻看以前的工作日志,于是写个程序验证。 .field static final $assertionsDisabled Z .method static <clinit>()V .limit registers 1 .line 85 16 const-class v0,org/lytsing/android/Assert 17 ; v0 : Ljava/lang/Class; 18 invoke-virtual {v0},java/lang/Class/desiredAssertionStatus ; desiredAssertionStatus()Z 19 ; v0 : Ljava/lang/Class; 20 move-result v0 21 ; v0 : single-length 22 if-nez v0,l1c6ac 23 ; v0 : single-length 24 const/4 v0,1 25 […]

Categories
Android

小探 android版QQ空间(体验版)

STONE说tx早有android版 QQ空间了,于是下载看看,感觉还行,功能太少了。不甘心,看看里面有什么好玩的,不会是个wrapper web的吧,于是决定反编译看个究竟。虽然大家都在骂腾讯,但不可否认的是,他们产品的用户体验做的很好, 搞android开发,也可以看看他们产品,好的界面设计,我们也可以拿来用。前文已经介绍了一些反编译apk的工具,搞软件开发的,至少有那么一点hack精神,学会反编译apk是Android应用程序开发的一项基本技能。 UI 界面是淡蓝色风格,也是我比较喜欢的风格,美工图片作图比较到位。看看下边的Tab吧,跟web一样了. 开始琢磨一下,到底用什么东东做的?原来是自定义的tabTextStyle,里面还有非常多自定义的view, style,正应那句话:“优秀的组件都是自定义的”。 personcenterheaderview.xml : <?xml version=”1.0″ encoding=”UTF-8″?> <LinearLayout android:orientation=”vertical” android:background=”@drawable/homepageheadbg” android:focusable=”false” android:layout_width=”wrap_content” android:layout_height=”wrap_content” xmlns:android=”http://schemas.android.com/apk/res/android”> <LinearLayout android:orientation=”horizontal” android:id=”@id/LinearLayoutUserMood” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_weight=”1.0″> <LinearLayout android:gravity=”center” android:background=”@drawable/personhead” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginLeft=”4.0px” android:layout_marginTop=”5.0px”> <ImageView android:id=”@id/ImageViewUserIcon” android:layout_width=”49.0dip” android:layout_height=”49.0dip” android:scaleType=”centerCrop” /> </LinearLayout> <LinearLayout android:orientation=”vertical” android:id=”@id/saynamegroup” android:background=”@drawable/saydialog” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”8.0px” android:layout_marginRight=”10.0px” android:layout_weight=”1.0″> <TextView android:textSize=”14.0px” android:textColor=”@color/black” android:ellipsize=”end” android:id=”@id/TextViewMood” android:layout_width=”wrap_content” […]

Categories
Android

强悍的Android反编apk译软件 apktool

apktool 下载地址: http://code.google.com/p/android-apktool/ 使用说明上面的链接也写非常清楚,需要注意的就是java是1.6版本的。 前段时间整理了一个 wiki文档 http://lytsing.org/wiki/android/decompile.html ,简要列出了三个反编译工具: smali dedexer dexdump 今天下午与absurd老大聊了一下,他说apktool很强大,于是G它一把,看到youtubu有两个视频: Apktool Demo 1 – Editing HTC_IME resources Apktool Demo 2 – Smali improvements 视频请自行翻墙观看。视频还有人留言:”Fantastic! Simply Awesome. Thanks so much, I will be looking for your dontate button” . Laugh!人家弄个软件也不容易啊。 AndroidManifest.xml 一般用 AXMLPrinter2.jar 反编译后,勉强看懂,但还有一些字符串没翻译,apktool做的更彻底,一步到位。不过用AXMLPrinter2.jar反编译xml文件输出的结果很整齐美观。用Eclipse格式化layout的xml文件,结果不那么令人满意。在Jeff Sharkey的一篇博文中,他说Roman Guy会把xml格式化很漂亮,为此,曾经给Roman Guy发过邮件,至今没得到回复:( 用dedexer反编译出来的ddx文件,参数名没显示出来, .method public static getSearchQueryForPublisher(Ljava/lang/String;)Ljava/lang/String; .limit registers […]

Pages: Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next