2014-05-02 22 views
2
<RelativeLayout 
     android:id="@+id/contact_relMainHeader" 
     android:layout_width="match_parent" 
     android:layout_height="50dip" 
     android:background="#16A180" 
     android:padding="5dp" > 

     <ImageView 
      android:id="@+id/contact_btnMenu" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_centerInParent="true" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="5dip" 
      android:background="@drawable/scrol" /> 

     <Button 
      android:id="@+id/contact_btnLogout" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="5dip" 
      android:background="@drawable/lock" /> 

     <ImageView 
      android:id="@+id/textView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_marginBottom="5dip" 
      android:layout_marginLeft="15dip" 
      android:layout_marginRight="15dip" 
      android:layout_marginTop="5dip" 
      android:layout_toLeftOf="@+id/contact_btnLogout" 
      android:background="@drawable/centertext" 
      android:gravity="center" 
      android:textAppearance="?android:attr/textAppearanceLarge" /> 
    </RelativeLayout> 

我需要創建標題像給定的圖像。如何製作標題在android中

enter image description here

,但我無法設置我試過,但沒有尋找彈出圖像​​。

這是我的屏幕:

enter image description here

我已經試過很多,但我無法實現退出等給出圖像

+1

只要停下來。您正在爲Android構建iOS設計。請閱讀Android的階梯指南,並以此知識構建新的應用程序。 – rekire

+0

* eject *是什麼意思? –

+0

查看標題與我的標題比較其即將推出像這樣我想讓它彈出像這樣 – Edge

回答

1

如果真要實現這一點,您的圖片拉伸所以不要使用background值。相反,使用src並且不要使用Button,請使用ImageView

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/contact_relMainHeader" 
     android:layout_width="match_parent" 
     android:layout_height="50dip" 
     android:background="#16A180" 
     android:padding="5dp" > 

     <ImageView 
      android:id="@+id/contact_btnMenu" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_centerVertical="true" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="5dip" 
      android:src="@drawable/scrol" /> 

     <ImageView 
      android:id="@+id/contact_btnLogout" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="5dip" 
      android:src="@drawable/lock" /> 

     <ImageView 
      android:id="@+id/textView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerVertical="true" 
      android:layout_centerHorizontal="true" 
      android:gravity="center" 
      android:src="@drawable/centertext" 
      /> 

    </RelativeLayout> 
+0

你可以上傳一個屏幕截圖嗎?這個佈局看起來如何? –

+0

我沒有圖像,所以不能完全顯示提問者屏幕。我使用自定義圖像來檢查它是否是他想要的。 –

+0

@SC好的。對你的答案罰款+1。 –

1
// try this way,hope this will help you... 

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/contact_lnrMainHeader" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:background="#16A180" 
    android:padding="10dp"> 

    <ImageView 
     android:id="@+id/contact_btnMenu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/ic_launcher"/> 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:layout_weight="1"> 
     <Button 
      android:id="@+id/contact_btnLogout" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/ic_launcher" /> 
    </LinearLayout> 
    <ImageView 
     android:id="@+id/textView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/ic_launcher" 
     android:adjustViewBounds="true"/> 

</LinearLayout> 
相關問題