Android的水平列表与轮状的旋转 [英] Android horizontal list with wheel-like rotating

查看:169
本文介绍了Android的水平列表与轮状的旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的小的应用程序,其中在某些时候用户需要选择一个选项。这是我收到的规格说,大约有可供选择的方案水平列表。该选项被选择时,它是一个箭头指针下面 - 在命运之轮类似

I am currently working on small app, where at some point user need to choose one option. The specification which I've received says about horizontal list with options to choose from. The option is chosen when it is below an arrow pointer - something like in wheel of fortune.

这是我迄今所做的:

我的活动

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        LinearLayout tl = (LinearLayout) findViewById(R.id.index);
        for (int i = 0; i < 10; i++) {
            TextView textview = new TextView(this);
            textview.setLayoutParams(new LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            textview.setText("Text " + i);
            tl.addView(textview);
        }
    }
}

我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />
        ... the rest of normal layout
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/value" />

        <HorizontalScrollView
            android:id="@+id/horizontalScrollView"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:scrollbars="none" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:id="@+id/index"
                android:orientation="horizontal" >
                ... there i put all the elements
            </LinearLayout>
        </HorizontalScrollView>
    </LinearLayout>

</RelativeLayout>

也有一个画面解释它的样子:

Also there is a picture explaining how it looks like:

所以,当箭头上面18厘米,那么TextView的(值)文本应该是18厘米。

So, when the arrow is above 18cm, then the textview (value) text should be 18cm.

有人可以帮助我与,或者至少说什么,我应该在谷歌搜索。

Can someone help me with that, or at least say what should I search for in Google.

编辑:

有一件事我刚刚意识到我没有提及 - 整个应用程序公顷s到是API兼容10+

There is one thing I've just realised I didn't mention about - the whole app ha s to be API 10+ compatible.

推荐答案

您正在寻找的小部件类似于Android的水平轮。有一个在 Android的spinnerwheel 的实现,它可以是你所需要的。

The widget you are looking for is similar to the android horizontal wheel. There is an implementation at android-spinnerwheel which can be what you need.

这篇关于Android的水平列表与轮状的旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆