android快捷设置标题样式布局
今天在看一些源码的时候,发现人家设置标题都不用样式布局文件,看了后感觉还是蛮方便的,
具体操作如下:
[java]
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.share);
添加代码
requestWindowFeature(Window.FEATURE_NO_TITLE);
设置不要标题,
然后在配置文件添加配置如下:
[java]
<?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>
此操作容易控制,但是布局多的话会写很多代码。
补充:软件开发 , Java ,