如何在xml android中设置标头?
我在我的应用程序页面中有一个标题,在这个标题中有2个图标和1个徽标。 我的问题是我不能在页面的顶部完整的标题,我想页面的顶部是完整的标题 请告诉我怎么做 坦克求救 我这样做:如何在xml android中设置标头?,xml,android-layout,graphics,android,Xml,Android Layout,Graphics,Android,我在我的应用程序页面中有一个标题,在这个标题中有2个图标和1个徽标。 我的问题是我不能在页面的顶部完整的标题,我想页面的顶部是完整的标题 请告诉我怎么做 坦克求救 我这样做: " 您可以试试这样的方法 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://sc
"
您可以试试这样的方法
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_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=".MainActivity"
android:background="#232043"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/headerlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="8"
android:orientation="horizontal" >
//Your Header Images and Icons Here
//You may use weights to fill them the screen
<ImageView
android:id="@+id/header"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="3"
android:background="#1b0534"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/helpi"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/helpi"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/abouti"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/abouti"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/logoi"
android:layout_width="0dp"
android:layout_height="45dp"
android:layout_weight="3"
android:layout_marginTop="10dp"
android:src="@drawable/lhead"
tools:ignore="ContentDescription" />
</LinearLayout>
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="60dp"
android:background="#3c2b86"
android:drawableLeft="@android:drawable/ic_menu_search"
android:ems="10"
android:gravity="right"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="15dp"
android:paddingTop="10dp"
android:singleLine="true"
android:textStyle="bold"
tools:ignore="HardcodedText,ExtraText,TextFields" >
<requestFocus />
</EditText>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#100826"
android:dividerHeight="0.5dp"
android:listSelector="#1b0534"
android:scrollbars="none" >
</ListView>
</LinearLayout>
//你的标题图片和图标在这里
//您可以使用权重在屏幕上填充它们
你说的是ActionBar标题吗?是的,我怎么说?尝试向图像视图中添加权重。它们可能有助于填充整个屏幕。如果你不知道如何在线性布局中使用权重,请告诉我。我已经编辑了文章。试着了解权重的使用。这不完全是你想要的,但可能会帮助你:/
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_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=".MainActivity"
android:background="#232043"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/headerlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="8"
android:orientation="horizontal" >
//Your Header Images and Icons Here
//You may use weights to fill them the screen
<ImageView
android:id="@+id/header"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="3"
android:background="#1b0534"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/helpi"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/helpi"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/abouti"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/abouti"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/logoi"
android:layout_width="0dp"
android:layout_height="45dp"
android:layout_weight="3"
android:layout_marginTop="10dp"
android:src="@drawable/lhead"
tools:ignore="ContentDescription" />
</LinearLayout>
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="60dp"
android:background="#3c2b86"
android:drawableLeft="@android:drawable/ic_menu_search"
android:ems="10"
android:gravity="right"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="15dp"
android:paddingTop="10dp"
android:singleLine="true"
android:textStyle="bold"
tools:ignore="HardcodedText,ExtraText,TextFields" >
<requestFocus />
</EditText>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#100826"
android:dividerHeight="0.5dp"
android:listSelector="#1b0534"
android:scrollbars="none" >
</ListView>
</LinearLayout>