2012-10-04 18 views
1
  1. 所有我想要做的是創造我的Android活動(屏幕)一個簡單的頁眉和頁腳。我在我的用戶界面中使用了RelativeLayout
  2. 並且如果我想添加一個彈出菜單中的頭我會怎麼做。

請分別回答這兩個問題。感謝創建頭

+0

點1) 的可能重複 點2) 有幾種方法可以做到這一點: - PopupMenu類(請參閱android文檔) - 創建自定義對話框(見的Android文檔) –

回答

0
For Header You can make an activity_header.xml Class. & it will include in other classes like as- 



<include 
     android:id="@+id/header" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     layout="@layout/activity_header" /> 


& for Footer you can use Tab Bar:- 
see this:- 
http://www.technotalkative.com/android-tab-bar-example-1/ 
+0

,我發現已經包括。什麼應該是activity_header.xml的代碼? – Nadeem

0
You can use like as:activity_header.xml Or You can use RelativeLayout for this 
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/header" 
    android:orientation="horizontal" > 

    <LinearLayout 
     android:id="@+id/ll_header" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal|bottom" 
     android:layout_marginBottom="2dip" 
     android:layout_weight="1" 
     android:clickable="true" 
     android:gravity="center_vertical|center_horizontal" 
     android:orientation="vertical" > 

     <ImageView 
      android:id="@+id/img_header_icon" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="10dp" 
      android:src="@drawable/header_logo" /> 


    </LinearLayout> 

</LinearLayout> 
+0

第一我已經創建了佈局文件夾這個文件。然後我已經包含在我的主要活動的XML文件,但沒有頭所顯示的 – Nadeem