Android编程实现修改标题栏位置使其居中的方法
更新时间:2015年11月13日 12:20:16 作者:ifaithu
这篇文章主要介绍了Android编程实现修改标题栏位置使其居中的方法,涉及Android布局设置的简单实现技巧,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了Android编程实现修改标题栏位置使其居中的方法。分享给大家供大家参考,具体如下:
package com.example.libraryclient;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.Window;
import com.example.R;
public class HomePageActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//设置布局
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_homepage);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.title);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
}
希望本文所述对大家Android程序设计有所帮助。
相关文章
Android开发教程之Fragment定义、创建与使用方法详解【包含Activity通讯,事务执行等】
这篇文章主要介绍了Android开发教程之Fragment定义、创建与使用方法,详细介绍了Fragment的概念、功能、定义、创建及使用方法,包括Fragment与Activity通讯,Fragment事务执行及Fragment应用示例等,需要的朋友可以参考下2017-11-11


最新评论