Android自定义窗口标题设置桌面图片颜色渐变进度条.doc
文本预览下载声明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 ?xml version=1.0 encoding=utf-8??
manifest xmlns:android=/apk/res/android?
??????package=cn.oyp.title?
??????android:versionCode=1?
??????android:versionName=1.0?
????uses-sdk android:minSdkVersion=8 /?
???
application
android:icon=@drawable/icon
android:label=@string/app_name?
????????activity
android:label=@string/app_name使用后app_name为默认标题,使用自定义请删除
android:name=.CustomTitleActivity?
????????????android:theme=@style/customTheme
????????????intent-filter?
????????????? action android:name=ent.action.MAIN /?
????????????????category android:name=ent.category.LAUNCHER /?
????????????/intent-filter?
????????/activity?
???
????/application?
/manifest Android自定义窗口标题实例
该实例的功能比较简单,但是通过该实例的扩展可以在自定义标题中做出菜单导航等实用的功能,为了实现自定义窗口标题,需要做以下几个步骤:
1、给自定义标题提供一个界面
2、将自定义标题应用给Activity窗口
3、把android系统为Activity设置的默认主题改为自己的主题
step2、编写自定义标题的布局文件 /res/layout/custom_title.xml
??
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 ?xml version=1.0 encoding=utf-8??
LinearLayout xmlns:android=/apk/res/android?
????android:orientation=horizontal android:layout_width=fill_parent?
!-- 指定背景,该背景自己画的 --?
android:layout_height=fill_parent android:background=@drawable/rectangle
???????Button android:id=@+id/infoAtMeTextView?
????????android:textColor=#FF0000 android:layout_width=wrap_content?
????????android:layout_height=match_parent android:layout_weight=1?
????????android:gravity=center android:text=\@我 /?
????Button android:id=@+id/infoCommentTextView?
????????android:textColor=#FF0000 android:layout_width=wrap_content?
????????android:layout_height=match_parent android:layout_weight=1?
????????android:gravity=center android:text=评论 /?
????Button android:id=@+id/infoPrivateMsgTextView?
????????android:textColor=#FF0000 android:layout_width=wrap_content?
????????android:layout_height=match_parent android:layout_weight=1?
????????android:gravity=center android:text=私信 /?
/LinearLayout
st
显示全部