Android aligner le centre de mise en page
J'essaie de faire de la Mise en page avec le LOGO et le TEXTE aligner au centre entre ActionBar et en Bas de mise en page.
Comme cette
J'essaie de le faire, mais il ne fonctionne pas corectly. Il faire la mise en page avec le logo par le centre de l'éboulis. Il ressemble cette
Le ce que quelqu'un sait où est misteke?
Mon code:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
//MainLayout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="text" >
//LOGO Layout
<RelativeLayout
android:id="@+id/relativeLayout0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center_vertical|center_horizontal|center" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="@dimen/mainlogo_height"
android:src="@drawable/gerb_big" />
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="text"
android:textColor="#900000"
android:textSize="@dimen/OA_size" />
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="text"
android:textColor="#900000"
android:textSize="@dimen/NU_size" />
</RelativeLayout>
//Bottom Layout
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerInParent="false"
android:layout_centerVertical="true"
android:gravity="bottom|center_horizontal|center" >
<ImageButton
android:id="@+id/home"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#ffffff"
android:onClick="home_Click"
android:scaleType="fitXY"
android:src="@drawable/home" />
<ImageButton
android:id="@+id/news"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toRightOf="@+id/home"
android:background="#ffffff"
android:onClick="news_Click"
android:scaleType="fitXY"
android:src="@drawable/database" />
<ImageButton
android:id="@+id/anons"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toRightOf="@+id/news"
android:background="#ffffff"
android:onClick="annons_Click"
android:scaleType="fitXY"
android:src="@drawable/calendar" />
<ImageButton
android:id="@+id/faculty"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toRightOf="@+id/anons"
android:background="#ffffff"
android:onClick="faculty_Click"
android:scaleType="fitXY"
android:src="@drawable/category" />
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
OriginalL'auteur Volodymyr | 2013-11-14
Vous devez vous connecter pour publier un commentaire.
Créer un
LinearLayout
qui est l'enfant de la racine de mise en page et enveloppe toutes les autres mises en page, puis de changerà
ou ajouter
android:layout_above="@+id/relativeLayout1"
à votre LOGO, mise en pageandroid:gravity="center_vertical|center_horizontal|centre" doit être écrit : android:gravity="center"
OriginalL'auteur Apoorv
Voici mon code et ma mise en page. J'espère que c'est ce dont vous avez besoin. :-
et voici la capture d'écran :-
OriginalL'auteur Rahul Gupta
Essayez d'ajouter
android:layout_above=@id/relativeLayout1
à votre logo, mise en page.OriginalL'auteur pshegger