自加顶部标题栏
title的布局:
<span style="font-size:18px;"><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="返回"/>
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="标题"/>
<Button
android:id="@+id/option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="操作"/>
</LinearLayout>
</span>主布局:
<span style="font-size:18px;"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.my.MainActivity" >
<include layout="@layout/title"/>
</RelativeLayout>
AndroidManifest.xml文件:</span><!-- android:theme="@style/Theme.AppCompat.NoActionBar"设置无顶部标题栏 -->
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: html中给地址栏添加icon图标
- 下一篇: 如何在网页中加入title图标
