-1

Androidでデザインしたいアプリに以下の種類のダッシュボードがあります。しかし、私はそれを設計どおりに作成することはできません。

これがデザインです...ここに画像の説明を入力

注 - 1、2、3 という名前の 6 つのボタンを使用しました。また、ViewStub を使用する共通ヘッダーもあります。そして、以下のような 320x480 の丸い円を作成し、それを背景画像として設定し、それに応じてボタンを配置しました。これは私が使用したアプローチです。

レイアウト コード :-

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background" >

    <LinearLayout
        android:id="@+id/banner"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dip" >

        <ViewStub
            android:id="@+id/vsHeader"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inflatedId="@+id/headings"
            android:layout="@layout/header" />
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/categories"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/banner" >

        <ImageView
            android:id="@+id/logo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:contentDescription="desc"
            android:src="@drawable/logo" />

        <Button
            android:id="@+id/one"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_below="@id/logo"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="100dp"
            android:background="@drawable/truck_button"
            android:onClick="onButtonClicker" />

        <Button
            android:id="@+id/two"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="20dp"
            android:layout_marginTop="150dp"
            android:background="@drawable/two"
            android:onClick="onButtonClicker" />

        <Button
            android:id="@+id/three"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/two"
            android:layout_below="@+id/two"
            android:layout_marginTop="15dp"
            android:background="@drawable/tire_button"
            android:onClick="onButtonClicker" />

        <Button
            android:id="@+id/four"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/two"
            android:layout_alignBottom="@+id/two"
            android:layout_marginLeft="25dip"
            android:layout_marginRight="14dp"
            android:background="@drawable/tow_truck_button"
            android:onClick="onButtonClicker" />

        <Button
            android:id="@+id/five"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/three"
            android:layout_alignBottom="@+id/three"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="25dip"
            android:background="@drawable/trailer_button"
            android:onClick="onButtonClicker" />

        <Button
            android:id="@+id/six"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/one"
            android:layout_below="@+id/five"
            android:background="@drawable/six"
            android:onClick="onButtonClicker" />
    </RelativeLayout>

</RelativeLayout>

誰かがこれについて何か考えを持っている場合は、親切に助けたり、貴重な提案を提供してください.

4

1 に答える 1

1

最も簡単なのは、独自のものを作成してCustomViewでクリックを追跡するonTouchことです。それ以外の場合:

  1. UI でさまざまなセグメントを準備する - 少なくとも 4 ~ 6
  2. 相対レイアウトを使用してそれらを整列する
  3. さまざまな解像度を試すときに展開したい個別の backgorund プロパティがあります。
于 2012-11-11T05:48:34.190 に答える