2014-12-25 99 views
-1

我想添加自定義橫幅到我的android項目中的視圖。我想要做同樣的事情,以我在這個iPhone應用程序,我看到橫幅文本和按鈕

enter image description here

到目前爲止,我有這個相對佈局

<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/ll1PostVideoPortrait" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true"> 



    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Cancel" 
     android:id="@+id/button3" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:text="Post Video" 
     android:layout_weight="1" 
     android:id="@+id/textView6" 
     android:layout_gravity="center_horizontal" /> 


</LinearLayout> 

不用說的裏面,看起來壞壞 enter image description here

任何更好的想法如何實現從iOS屏幕截圖看?

+0

你可以使用一個動作條。或者一個佈局(我喜歡RelativeLayouts,但LinearLAyout可以)與兩個TextViews。其餘的只是顏色,字體大小和樣式的問題。注意TextView是**可點擊的**,所以你真的不需要按鈕。 –

回答

0

試試這個佈局..

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="60dp" 
    android:background="#3f3f3f" > 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_centerVertical="true" 
    android:text="cancel" 
    android:layout_marginLeft="5dp" 
    android:textSize="20dp" 
    android:textColor="#ffffff"/> 

<TextView 
    android:id="@+id/textView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBaseline="@+id/textView1" 
    android:layout_alignBottom="@+id/textView1" 
    android:layout_marginLeft="40dp" 
    android:layout_toRightOf="@+id/textView1" 
    android:textColor="#ffffff" 
    android:textSize="20dp" 
    android:textStyle="bold" 
    android:text="Post Video" /> 

</RelativeLayout> 


Note: 
For click events, you can set ClickListener on TextViews. 

希望這有助於你....