Android的水平滚动菜单

Android的水平滚动菜单

本文介绍了Android的水平滚动菜单(如在谷歌的位置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想实现像在谷歌应用程序的位置的菜单。

I would like to implement a menu like in the google locations app.

它看起来像如果要移动指针向左向右水平滑动菜单,但图像幻灯片。
onClick事件trigered只是没有额外的手指点击发布之后

It looks like horizontal slide menu but image slides left if you move pointer right.onClick event trigered just after finger release without additional click

推荐答案

创建水平的LinearLayout ,并添加到它想要的点击的ImageView 秒。
最后包装这一切在 Horizo​​ntalScrollView ,像这样(本例中是按钮):

Create a horizontal LinearLayout and add to it your desired clickable ImageViews.Finally wrap all of this in a HorizontalScrollView, Like this (this example is with buttons):

  <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="47dp"
        android:scrollbars="none" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:background="@drawable/bar_edit"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/bAll"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button1_all"
                android:clickable="true"
                android:onClick="onTasksListFilterButtonPressed"
                android:text="@string/all"
                android:textColor="@color/my_black" />

            <Button
                android:id="@+id/bWaiting"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button2_pending"
                android:clickable="true"
                android:onClick="onTasksListFilterButtonPressed"
                android:text="@string/waiting"
                android:textColor="@color/my_white" />

            <Button
                android:id="@+id/bInProgress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button3_in_progress"
                android:clickable="true"
                android:onClick="onTasksListFilterButtonPressed"
                android:text="@string/inprogress"
                android:textColor="@color/my_white" />

            <Button
                android:id="@+id/bOnTheWay"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button4_on_the_way"
                android:clickable="true"
                android:onClick="onTasksListFilterButtonPressed"
                android:text="@string/ontheway"
                android:textColor="@color/my_white" />

            <Button
                android:id="@+id/bComplete"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button5_complete"
                android:clickable="true"
                android:onClick="onTasksListFilterButtonPressed"
                android:text="@string/complete"
                android:textColor="@color/my_white" />

            <Button
                android:id="@+id/bFailed"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button6_failed"
                android:clickable="true"
                android:onClick="onTasksListFilterButtonPressed"
                android:text="@string/failed"
                android:textColor="@color/my_white" />
        </LinearLayout>
    </HorizontalScrollView>

这篇关于Android的水平滚动菜单(如在谷歌的位置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:38