Android: Was ist bestes Layout zu verwenden, wenn sie versuchen 2x2 Bilder Tasten zu bekommen, und mehr?

StackOverflow https://stackoverflow.com/questions/3441337

Frage

Ich versuche, mein Layout aussehen so zu machen. Ich habe Gridviews, Tabellenlayouts versucht, und mehr, aber kann es nicht richtig angezeigt bekommen. Ich möchte so etwas wie diese.

Image ImageButton2

ImageButton3 ImageButton4

    ImageView1

ImageButton5 ImageButton6

ImageButton6 ImageButton7 ImageButton8 (diese sind kleinere Symbole)

   ImageButton9 (small donate button)

Ich kann nur scheinen, um herauszufinden, wie das Layout der Arbeit mit imagebuttons zu bekommen. Was das Layout soll ich verwenden? Und könnten Sie senden Sie Beispiel-Code des XML-Layout, wenn möglich?

War es hilfreich?

Lösung

könnten Sie etwas tun, auch wenn es eine andere Möglichkeit sein kann, es zu tun:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

  <LinearLayout android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <ImageButton android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
    <ImageButton android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
  </LinearLayout>

  <ImageView android:layout_width="wrap_content" android:src="@drawable/icon"
    android:layout_height="wrap_content" android:layout_gravity="center"/>

  <LinearLayout android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <ImageButton  android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
    <ImageButton  android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
  </LinearLayout>

  <LinearLayout android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <ImageButton  android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
    <ImageButton  android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
    <ImageButton  android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
  </LinearLayout>

  <ImageView android:layout_gravity="center"  android:src="@drawable/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
</LinearLayout>

Hier ist das Ergebnis. Ich warf zusammen ein Android-Projekt und nur das Bild verwendet, die für das Symbol Verzug geraten ist.

alt text

Andere Tipps

Vielleicht kann dies Sie helfen:

DroidDraw - User Interface (UI) Designer / Editor für die Programmierung mit Android

Sie können den grafischen Editor verwenden, um das Layout zu machen, und die XML generieren.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top