2013-10-09 30 views
1

我想创建一个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> 

这是对丝毫不差的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:

  • 我怎么能放在标题栏(红色方框)的标志(图像)的中间?

  • 如何将这2个布局插入其他活动?例如,我怎样才能让我的主要布局包含这两种布局?

+0

使用sherlock动作栏库创建自定义标题栏 – harikrishnan

+0

好吧,不是我需要的动作栏,而是一个自定义标题,但我会看看它。谢谢 – masmic

回答

0

回答了第二个问题:包括布局成另一种布局:

<include 
    layout = "@layout/custom_tittlebar" > 
</include> 

我仍然与标题栏的战斗,我希望把图像这样,我想,如果这是最好的方法,或者我可能需要使用photoshop创建一个图像设置其上的徽标,然后将其设置为布局中的背景。