android - 长按时的圆形按钮背景和提示

标签 android android-layout button android-appcompat android-button

我创建了一个 ImageButton,当我长按它时,它的背景会变成黑色。我怎样才能改变它的风格 thisthis one

另外,我如何添加 this brief hint执行长按时到按钮?

最佳答案

您可以使用:

    <androidx.appcompat.widget.AppCompatImageButton
        android:background="?attr/selectableItemBackgroundBorderless"
        ../>

和:

    val imageButton : ImageButton = findViewById(R.id.imagebutton)
    ViewCompat.setTooltipText(imageButton, "Tooltip")

关于android - 长按时的圆形按钮背景和提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64347822/

相关文章:

android - 自定义 View 不响应触摸

javascript - 是否可以在 Jquery Mobile 中创建 "clicked"输入类型按钮?

android - React Native iOS 构建失败, "Multiple commands produce"错误

android - 在导航 View 之间添加分隔线

android - OPC UA 支持 QT 移动

android - 诺基亚应用内计费(计费 v3 支持错误检查)

android - xml 文件中未知的感叹号

android - 在 Android 中使用 ASyncTask 加载布局

css - 带换行符的多行 HTML 输入按钮添加了不需要的边距

android - 在 Tablelayout 中设置其参数后按钮丢失