Android 当我放置指针/触摸按钮时,如何设置按钮的可见/不可见?

Android 当我放置指针/触摸按钮时,如何设置按钮的可见/不可见?,android,image,button,Android,Image,Button,我正在制作一个应用程序,我想显示图像列表。通常我可以显示图像。我用导航按钮左右显示了这些图像。供参考。当我按下左键时,显示上一张图像,右键显示下一张图像。但事实上,我不想总是显示按钮,当我的指针指向那里时,它必须是可见的。 否则,只需显示图像。 有什么想法吗。。 而且我的图像大小都不一样,我怎么才能得到模拟器的大小呢?然后它很容易调整图像大小,并在可绘制列表中设置 code for left button: <Button android:id="@+id/butt

我正在制作一个应用程序,我想显示图像列表。通常我可以显示图像。我用导航按钮左右显示了这些图像。供参考。当我按下左键时,显示上一张图像,右键显示下一张图像。但事实上,我不想总是显示按钮,当我的指针指向那里时,它必须是可见的。 否则,只需显示图像。 有什么想法吗。。 而且我的图像大小都不一样,我怎么才能得到模拟器的大小呢?然后它很容易调整图像大小,并在可绘制列表中设置

    code for left button:
    <Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/bttn"
    android:layout_alignBottom="@+id/bttn"
    android:layout_alignParentRight="true"
    android:onClick="ClickHandler2"
    android:background="@drawable/android_lbutton"
    />
    in drawable/android_lbutton

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/timthumb6"
      android:state_pressed="true" />
<item android:drawable="@drawable/timthumb3"
      android:state_focused="true" />
<item android:drawable="@drawable/timthumb8" />
     </selector>

左按钮的代码:
内置可拖动/安卓按钮
这里的timthumb6、timthumb3、timthumb8是三个具有不同颜色的左按钮

Button _button=(Button)findViewById(R.id.button1);
    _button1.setVisibility(View.INVISIBLE);
或者你可以先把它们看不见,然后你可以让它在你想去的任何地方可见


或者你可以先将它们设置为不可见,然后你可以将其显示在你想要的任何位置

最初将两个按钮都设置为不可见状态…并为两个按钮和imageview实现ontouch侦听器。。。在按钮的ontouch中,将其设置为可见。。在imageview的ontouch中,再次将两个按钮设置为不可见

最初将两个按钮都置于不可见状态…并为两个按钮以及imageview实现ontouch侦听器。。。在按钮的ontouch中,将其设置为可见。。在imageview的ontouch中,再次将两个按钮设置为不可见

您是否尝试创建选择器

按=真;焦点=真;drawable=“箭头”


按=假;焦点=错误;drawable=“transparent”

您是否尝试创建选择器

按=真;焦点=真;drawable=“箭头”

按=假;焦点=错误;drawable=“透明”