【问题标题】:Dashboard Design in Android [closed]Android中的仪表板设计[关闭]
【发布时间】:2012-10-31 00:03:59
【问题描述】:

我的应用中有以下仪表板,我想在 Android 中设计。但我无法创建与设计相同的。

这里是设计...

注意 - 使用了 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>

如果有人对此有任何想法,请提供帮助或提供您宝贵的建议。

【问题讨论】:

    标签: android android-layout android-relativelayout dashboard


    【解决方案1】:

    最简单的方法是创建您自己的CustomView 并跟踪onTouch 的点击,否则您:

    1. 在 UI 上准备不同的片段 - 至少 4-6 个
    2. 使用相对布局对齐它们
    3. 具有它们单独的背景属性,您可以在尝试不同分辨率时对其进行扩展。

    【讨论】:

    • 感谢您的建议。我对自定义视图一无所知。我将在谷歌上搜索教程,但如果您有任何参考,请提供。
    • 想一想,如果你擅长网络技术,你可以在几个小时内用 CSS3 为 android 制作这样一个仪表板,然后使用 Chrome 桥连接。
    • 该链接几乎包含您想要构建的所有内容developer.samsung.com/android/samples-4
    • 非常感谢您的链接。
    猜你喜欢
    • 2012-12-05
    • 2011-06-14
    • 2017-04-13
    • 2012-02-18
    • 2011-04-11
    • 2010-09-30
    • 2023-03-22
    • 1970-01-01
    • 2019-07-21
    相关资源
    最近更新 更多