您的位置:首页 > 移动开发 > Android开发

android快捷设置标题样式布局

2012-10-17 13:52 281 查看
今天在看一些源码的时候,发现人家设置标题都不用样式布局文件,看了后感觉还是蛮方便的,

具体操作如下:

super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.share);

添加代码

requestWindowFeature(Window.FEATURE_NO_TITLE);

设置不要标题,

然后在配置文件添加配置如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<RelativeLayout
android:id="@+id/rl_top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >

<TextView
android:layout_width="fill_parent"
android:layout_height="44dp"
android:background="#486a9a"
android:gravity="center"
android:text="分享例子"
android:textColor="@android:color/white"
android:textSize="18sp" />
</RelativeLayout>

<Button
android:id="@+id/share"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="分享" />

</LinearLayout>




此操作容易控制,但是布局多的话会写很多代码。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: