La présentation du tableau de bord n'a pas fonctionné pour moi, c'est pourquoi je propose une solution basée sur la présentation. Il s'agit simplement d'un ensemble de modèles dans des modèles.
La clé est la relativité des poids entre les dispositions d'espacement et les dispositions de contenu.
Vous pouvez très simplement déplacer les icônes et définir d'autres dispositions pour des tableaux de bord plus grands ou plus légers.
Voici à quoi cela ressemble :
Et voici le xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dashboard"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout style="@style/dashboard_space_vertical" />
<LinearLayout style="@style/dashboard_content_vertical" >
<FrameLayout style="@style/dashboard_space_horizontal" >
</FrameLayout>
<LinearLayout style="@style/dashboard_content_horizontal" >
<ImageView
style="@style/dashboard_imageview"
android:src="@android:drawable/sym_call_missed" />
<TextView
style="@style/dashboard_textview"
android:text="Text 1" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_horizontal" />
<LinearLayout style="@style/dashboard_content_horizontal" >
<ImageView
style="@style/dashboard_imageview"
android:src="@android:drawable/sym_call_missed" />
<TextView
style="@style/dashboard_textview"
android:text="Text 2" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_horizontal" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_vertical" />
<LinearLayout style="@style/dashboard_content_vertical" >
<FrameLayout style="@style/dashboard_space_horizontal" />
<LinearLayout style="@style/dashboard_content_horizontal" >
<ImageView
style="@style/dashboard_imageview"
android:src="@android:drawable/sym_call_missed" />
<TextView
style="@style/dashboard_textview"
android:text="Text 3" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_horizontal" />
<LinearLayout style="@style/dashboard_content_horizontal" >
<ImageView
style="@style/dashboard_imageview"
android:src="@android:drawable/sym_call_missed" />
<TextView
style="@style/dashboard_textview"
android:text="Text 4" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_horizontal" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_vertical" />
<LinearLayout style="@style/dashboard_content_vertical" >
<FrameLayout style="@style/dashboard_space_horizontal" />
<LinearLayout style="@style/dashboard_content_horizontal" >
<ImageView
style="@style/dashboard_imageview"
android:src="@android:drawable/sym_call_missed" />
<TextView
style="@style/dashboard_textview"
android:text="Text 5" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_horizontal" />
<LinearLayout style="@style/dashboard_content_horizontal" >
<ImageView
style="@style/dashboard_imageview"
android:src="@android:drawable/sym_call_missed" />
<TextView
style="@style/dashboard_textview"
android:text="Text 6" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_horizontal" />
</LinearLayout>
<FrameLayout style="@style/dashboard_space_vertical" />
</LinearLayout>
Voici les styles :
<resources>
<style name="dashboard_space_vertical">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">0px</item>
<item name="android:layout_weight">1</item>
</style>
<style name="dashboard_content_vertical">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">0px</item>
<item name="android:layout_weight">3</item>
<item name="android:layout_gravity">center</item>
</style>
<style name="dashboard_space_horizontal">
<item name="android:layout_width">0px</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">2</item>
<!-- <item name="android:background">@color/black</item> -->
</style>
<style name="dashboard_content_horizontal">
<item name="android:layout_width">0px</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">3</item>
<item name="android:orientation">vertical</item>
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center</item>
</style>
<style name="dashboard_imageview">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">1</item>
<item name="android:scaleType">fitCenter</item>
</style>
<style name="dashboard_textview">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center</item>
<item name="android:textSize">@dimen/dashboard_thumbnail_text_size</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/blue</item>
</style>
</resources>
J'espère que cela aidera quelqu'un. Bon appétit.