我想创建一个Android界面,类似于启动器。为此,我需要在屏幕的每一侧创建一个自定义标题栏和2个边框。
我的应用程序中有几个活动,我需要将它们放在所有这些活动中,所以我需要创建独立的布局,一个是自定义标题栏,另一个是边框。结果可能是这样的:
draw http://img11.imageshack.us/img11/9599/qlus.png
这是边框的xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/border_left"
android:layout_width="100dip"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_alignParentLeft="true"
android:background="#000000" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/border_right"
android:layout_width="100dip"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_alignParentRight="true"
android:background="#000000" >
</RelativeLayout>
这是tittle的xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:orientation="horizontal"
android:background="#000000" >
问题是2:
如何在标题栏(红色方块)中间放置徽标(图像)?
如何将这两个布局插入其他活动?例如,我怎样才能使我的普通主布局包含这两种布局?
答案 0 :(得分:0)
回答第二个问题:将布局包含在另一个布局中:
<include
layout = "@layout/custom_tittlebar" >
</include>
我仍在使用标题栏,我想把图像放在那里,我想是否这是最好的方法,或者我可能需要用photoshop创建一个图像,然后在上面设置徽标,然后将其设置为布局中的背景。