2012-10-04 1 views
1
  1. Tout ce que je veux faire est de créer un en-tête et un pied de page simple dans mon activité android (écran). Je l'ai utilisé RelativeLayout dans mon interface utilisateur.
  2. Et si je voulais ajouter un menu contextuel en-tête comment pourrais-je faire cela.

S'il vous plaît répondre à deux questions séparément. MerciCréation d'en-tête sur un écran (activité)

+0

point 1) en double possible de point 2) Il y a plusieurs façons de le faire: - PopupMenu classe (voir Docs Android) - Créer dialogue personnalisée (voir Docs Android) –

Répondre

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

que j'ai trouvé déjà à inclure. Quel devrait être le code de 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

première fois que je créé ce fichier dans le dossier de mise en page .. Ensuite, je l'ai inclus dans le fichier xml de mon activité principale, mais aucun en-tête est montré – Nadeem

Questions connexes