代码改变世界

【android】 新浪oauth,进度条,AnimationDrawable,Toast,android预定义style

2012-08-06 22:45  Loull  阅读(369)  评论(0编辑  收藏  举报

使用新浪oauth:

http://www.cnblogs.com/liangxing/archive/2010/10/19/1855938.html

申请了Appid,使用很简单,官方给的sdk里面有两个项目,一个是源文件,另一个是使用demo。

填上token,secret后,callback_url可以填自己的博客,demo就能使用了。

注意:demo右击--属性--Android--后边下面的Library中Add ..\com_weibo_android就能使用了。

 

进度条:Android loading 效果

Android Market的 Loading效果

http://lishuaishuai.iteye.com/blog/1118969

思路:

http://www.eoeandroid.com/thread-994-1-1.html

在我的实验中,可以在init()里面setVisible(VISIBLE),在refresh()中设置为不可见,中间过程交给后台MainService开启新线程来完成,很优雅。

注意:在Main.xml里面<include>定义好的progress_bar,比如<include android:id="@+id/progress_loading" layout="@layout/progressbar">

 

AnimationDrawable逐帧动画(每一帧都已定义)  和 补间动画(定义了首尾帧,中间由系统计算得到)

http://hi.baidu.com/lphack/item/e3c182ee316871225a2d64d4

http://wangstar.iteye.com/blog/409115

http://wiki.eoeandroid.com/Drawable_Animation

配合使用,软件启动页面效果不错。

定义一个补间动画,监听补间动画的开始和结尾事件,作为AnimationDrawable的开始和结束动作。即在开始事件中animDrawable.start();

 

Toast

小提示

 

android预定义style:

http://ithinkfeed.iteye.com/blog/837982

字体大小

对于能够显示文字的控件(如TextView EditText RadioButton Button CheckBox Chronometer等等),你有时需要控制字体的大小。Android平台定义了三种字体大小。

"?android:attr/textAppearanceLarge"

"?android:attr/textAppearanceMedium"

"?android:attr/textAppearanceSmall"

使用方法为:

android:textAppearance="?android:attr/textAppearanceLarge" 
android:textAppearance="?android:attr/textAppearanceMedium" 
android:textAppearance="?android:attr/textAppearanceSmall"

style="?android:attr/textAppearanceLarge" 
style="?android:attr/textAppearanceMedium" 
style="?android:attr/textAppearanceSmall"

字体颜色

android:textColor="?android:attr/textColorPrimary" 
android:textColor="?android:attr/textColorSecondary" 
android:textColor="?android:attr/textColorTertiary" 
android:textColor="?android:attr/textColorPrimaryInverse" 
android:textColor="?android:attr/textColorSecondaryInverse"

ProgressBar

style="?android:attr/progressBarStyleHorizontal" 
style="?android:attr/progressBarStyleLarge" 
style="?android:attr/progressBarStyleSmall" 
style="?android:attr/progressBarStyleSmallTitle"

分隔符

横向:

<View android:layout_width="fill_parent" 
      android:layout_height="1dip" 
      android:background="?android:attr/listDivider" />

纵向:

<View android:layout_width="1dip" 
      android:layout_height="fill_parent" 
      android:background="?android:attr/listDivider" />

CheckBox

style="?android:attr/starStyle"

类似标题栏效果的TextView

style="?android:attr/listSeparatorTextViewStyle"

其它有用的样式

android:layout_height="?android:attr/listPreferredItemHeight"

android:paddingRight="?android:attr/scrollbarSize"

style="?android:attr/windowTitleBackgroundStyle"

style="?android:attr/windowTitleStyle"

android:layout_height="?android:attr/windowTitleSize"

android:background="?android:attr/windowBackground"

更多细节可参考SDK文档的R.attr类。

在MainActivity中加载<include>的view,View progress_bar = this.findViewById(R.id.progress_loading);