Je suis un débutant total dans la mise en page Android, mais je veux centrer le contenu verticalement et horizontalement.Android Centrer le contenu
donc ce livre que je lis dit ceci:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:padding="30dip"
android:orientation="horizontal" >
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center" >
...component.. etc...
Cela fonctionne et je pense que je reçois, sauf dit Eclipse:
Ce LinearLayout ou son parent ne sert à rien; transférer l'arrière-plan attribuer à l'autre vue
Mais je ne comprends pas?
de publier votre fichier XML complet. –
RelativeLayout a beaucoup de centrage. Mais pourquoi LinearLayout dans un LinearLayout .O –
Il n'affecte pas sérieusement les performances des applications –