Android是否支持这种可以左右按键的按钮

Android是否支持这种可以左右按键的按钮,android,button,customization,Android,Button,Customization,Android是否支持上述按钮 该按钮用于小键盘,如果按向右键,其中的文本将向右移动并更改为下一个选项,否则按向左键,文本将向左移动 这种按钮怎么样 谢谢 您好,请使用android提供的切换按钮 您不能根据按下的区域使按钮的动作有所不同。但您可以设计“水平”线性布局 -创建2个图像视图(1个用于左侧,1个用于右侧) -将这两个控件放置在线性布局(水平方向)内 -为每一个设置不同的onClick处理程序函数使用relativelayout:: <RelativeLayout xmlns:a

Android是否支持上述按钮

该按钮用于小键盘,如果按向右键,其中的文本将向右移动并更改为下一个选项,否则按向左键,文本将向左移动

这种按钮怎么样


谢谢

您好,请使用android提供的切换按钮


您不能根据按下的区域使按钮的动作有所不同。但您可以设计“水平”线性布局

-创建2个图像视图(1个用于左侧,1个用于右侧)
-将这两个控件放置在线性布局(水平方向)内

-为每一个设置不同的onClick处理程序函数

使用relativelayout::

<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"
android:id="@+id/rlt1"   
tools:context=".MainActivity" >

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bg" >

    <ImageButton
        android:id="@+id/leftArrowId"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="24dp"
        android:src="@drawable/larrow" />

    <ImageButton
        android:id="@+id/rightArrowId"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginRight="24dp"
        android:src="@drawable/rarrow" />

</RelativeLayout>

根据您的图像,选择两个不同的箭头图标,一个左箭头和一个右箭头,以及一个背景图像

背景图像bg将被删除

左箭头将是


右箭头将显示

您可以制作此按钮的三个版本。1.就像这样,2。如果你点击右边,它看起来是什么样子,3。若你们点击左边,它看起来是什么样子。然后,您可以使用imageview显示图像并自行处理单击操作查看我的答案,我已经发布了完整的解决方案布局