Android中自定义标题栏(一)
2012-01-11 15:19
316 查看
activity代码
layout/titlebar代码
package com.android.demo; import android.app.Activity; import android.os.Bundle; import android.view.Window; import android.widget.TextView; public class MytestActivity extends Activity { TextView myText; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.titlebar); myText = (TextView)findViewById(R.id.myText); myText.setText("自定义标题栏"); } }
layout/titlebar代码
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/myText" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>效果图
![](http://hi.csdn.net/attachment/201201/11/0_1326266512z3P2.gif)
相关文章推荐
- Android自定义标题栏的实现,及屏蔽系统标题栏
- 【Android】自定义标题栏 (解决了标题栏两侧空隙问题)
- Android自定义标题栏
- Android应用开发基础篇(14)-----自定义标题栏
- 解决android自定义标题栏充满的问题
- android 修改窗体标题的字体式样和背景图(自定义标题栏)
- android带返回按钮的自定义标题栏
- Android自定义标题栏
- 【Android】自定义标题栏
- android带返回按钮的自定义标题栏布局文件详解
- 【Android UI】自定义带按钮的标题栏
- android 自定义标题栏
- 菜鸟初学android体验之——实现自定义简单标题栏的两种简单方法
- Android自定义顶部标题栏
- Android自定义标题栏控件(补充)
- Android 自定义标题栏(title栏) .
- Android--自定义标题栏之显示网页加载进度
- Android自定义标题栏
- android - 自定义标题栏(在标题栏中增加按钮和文本居中)
- Android-自定义标题栏