首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建仪表盘

创建仪表盘
EN

Stack Overflow用户
提问于 2016-03-01 19:59:40
回答 1查看 1.1K关注 0票数 0

我在试着创建一个量规。我有一个空白仪表的PNG和第二个,完全相同的大小显示针。我的想法是将指针覆盖在仪表的顶部,然后根据我希望显示的值旋转它。我很难把一张图片放在另一张图片上。有人知道怎么做吗?图像在LinearLayout中。

EN

回答 1

Stack Overflow用户

发布于 2018-01-29 00:14:28

为此,您可以使用RelativeLayout。

代码语言:javascript
复制
<RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/needle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/needle" />

            <ImageView
                android:id="@+id/cluster"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/cluster" />

            <TextView
                android:id="@+id/rpmVal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="27dp"
                android:text="00000"
                android:textColor="#ffffff"
                android:textSize="60sp"
                android:textStyle="italic" />

            <TextView
                android:id="@+id/textView23"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/rpmVal"
                android:layout_alignBottom="@+id/rpmVal"
                android:layout_toEndOf="@+id/rpmVal"
                android:text="RPM"
                android:textColor="#ffffff" />

            <TextView
                android:id="@+id/textView24"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_above="@+id/rpmVal"
                android:layout_marginBottom="40dp"
                android:layout_toStartOf="@+id/textView23"
                android:text="x100 rpm"
                android:textColor="#ffffff"
                android:textSize="10sp" />

        </RelativeLayout>

此设置应如下所示:

我希望我能帮上忙

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35722323

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档