1

我正在设计一个简单的类似于万用表的 android 应用程序。想法是有一个类似控制的旋转控制旋钮,它可以让我选择我想要测量的参数。即电压、电流或电阻。

尽管我对功能(万用表内部工作原理)非常清楚,但我对 UI 缺乏想法。

使用Inkscape,我能够创建时尚的万用表外观图像和旋转选择旋钮。我的想法是使用万用表图像作为背景,并将旋钮放在万用表图像的顶部。此外,我应该能够使用android.graphics.Matrix中可用的 Matrix 类来旋转旋钮的图像

问题是我如何在 Android 中设计这样的东西?

我是否必须在 Android 中使用复合视图或

我是否必须创建一些自定义视图并将其包含在主布局文件中。?

或者有没有更好的解决方案我可以使用?

任何帮助都深表感谢。

干杯瓦萨

4

1 回答 1

1

这是我最近的项目:

查看 ( controller_activity.xml):

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


    <ImageView
            android:id="@+id/controller_image" android:src="@drawable/your_knob_image"
            android:layout_marginTop="10dp"
            android:layout_alignParentTop="true" android:layout_centerHorizontal="true"
            android:scaleType="matrix"
            android:layout_width="wrap_content" android:layout_height="wrap_content">
    </ImageView>

</RelativeLayout>

活动(ControllerActivity.java)(来自http://hub.tutsplus.com/tutorials/android-sdk-creating-a-rotating-dialer--mobile-8868的逻辑 [和休息] ):

public class ControllerActivity extends Activity {

    //your fields

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.controller_activity);

        ImageView controllerImage = (ImageView) findViewById(R.id.controller_image);

        //the rest from link
    }
}
于 2013-08-08T09:18:55.123 回答