Three20是一个iPhone开发图形接口类的集合,包含图片查看,一般工具,HTTP本地缓存。Three20是来自于 Facebook的iPhone程序源代码的。
添加Three20到您的程序
==============================
Three20是预编译静态库,最简单的方法是使用Xcode的依赖工程特性,下面是方法:
1. 复制(Clone命令)three20 git(GitHub) 目录: `git clone git://github.com/joehewitt/three20.git`. 确保将其储存在一个常用位置,以便Xcode每次编译时来索引和访问
2. 在 “three20/src”中找到 “Three20.xcodeproj” . 拖拽Three20.xcodeproj到您工程的根目录”Groups and Files”边栏中.在弹出对话框中去掉”Copy items”的对号,”Reference Type”选择”Relative to Project”然后点“Add”.
3. 现在要链接Three20库到您的工程。点击添加进来的”Three20.xcodeproj”,在“Details”表中,你会看到 libThree20.a. 打上文件右侧的对号
4. 现在你需要设置320库为你程序的依赖库,以便Xcode在编译的时候也会将320一起编译起来。展开左侧的“Targets”标签,双击您程序的“目 标”文件。在“General”标签下,你会看到“Direct Dependencies”,点“+”号添加320库。
5. 现在你需要添加图片和字符串包到你的程序,找到”Three20.bundle”在”three20/src”中,然后拖拽到你的程序中。对话框里面 “Copy items”别选,“reference type”选“relative to project”
6. 现在,你需要添加 Core Animation framework到你的工程。点击程序target,然后在frameworks里面添加 QuartzCore.framework就可以了(这个不是翻译的,原来的方法太麻烦了
7. 最后,我们需要让你的工程找得到320库的文件头。打开 “Project Settings”找到”Build”标签,找到 “Header Search Paths”双击它。添加到”three20/src”相对目录的地址。
8. 当你在 Project Settings, 找到 “Other Linker Flags”在”Linker”区,添加”-ObjC”和”-all_load”。
9. OK,在用320库的地方添加 #import “Three20/Three20.h” 就好了。
可以使用如下方法设置 Toast 显示的位置
public void setGravity (int gravity, int xOffset, int yOffset)
Set the location at which the notification should appear on the screen.
默认的 Gravity 是
int mGravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;显示在屏幕的下方,水平居中。
[/color][color=red]04-08 16:28:27.679: DEBUG/AndroidRuntime(1033): Shutting down VM
04-08 16:28:27.679: WARN/dalvikvm(1033): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): FATAL EXCEPTION: main
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): java.lang.ArithmeticException: divide by zero
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.mutateColumnsWidth(TableLayout.java:576)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.shrinkAndStretchColumns(TableLayout.java:565)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.measureVertical(TableLayout.java:463)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.onMeasure(TableLayout.java:428)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.View.measure(View.java:8171)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableRow.measureChildBeforeLayout(TableRow.java:221)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:696)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableRow.onMeasure(TableRow.java:112)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.View.measure(View.java:8171)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.measureChildBeforeLayout(TableLayout.java:453)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.measureVertical(TableLayout.java:465)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.TableLayout.onMeasure(TableLayout.java:428)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.View.measure(View.java:8171)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.View.measure(View.java:8171)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.View.measure(View.java:8171)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.View.measure(View.java:8171)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.os.Looper.loop(Looper.java:123)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at java.lang.reflect.Method.invoke(Method.java:521)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-08 16:28:27.728: ERROR/AndroidRuntime(1033): at dalvik.system.NativeStart.main(Native Method)
04-08 16:28:27.848: DEBUG/dalvikvm(1033): GC_FOR_MALLOC freed 3984 objects / 305752 bytes in 102ms
04-08 16:28:27.869: WARN/ActivityManager(60): Force finishing activity com.zgj/.mineActivity
04-08 16:28:28.408: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44016068 com.zgj/.mineActivity}
04-08 16:28:30.119: INFO/Process(1033): Sending signal. PID: 1033 SIG: 9
04-08 16:28:30.149: INFO/ActivityManager(60): Process com.zgj (pid 1033) has died.
04-08 16:28:30.149: INFO/WindowManager(60): WIN DEATH: Window{43ff80c0 com.zgj/com.zgj.mineActivity paused=false}
04-08 16:28:30.239: WARN/InputManagerService(60): Got RemoteException sending setActive(false) notification to pid 1033 uid 10033