android快捷设置标题样式布局
16lz
2021-01-25
今天在看一些源码的时候,发现人家设置标题都不用样式布局文件,看了后感觉还是蛮方便的,
具体操作如下:
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>
此操作容易控制,但是布局多的话会写很多代码。
更多相关文章
- 没有一行代码,「2020 新冠肺炎记忆」这个项目却登上了 GitHub 中
- Android(安卓)用Animation-list实现逐帧动画
- Android界面设计的一点体会
- Android(安卓)反编译apk
- Android(安卓)在代码中动态设置字体颜色需要注意的问题
- [转]Android(安卓)UI学习 - Tab的学习和使用
- android studio 多渠道打包
- Android以太网固定ip
- Android中实现ListView横向滑动