android-imagebutton 相关问题

显示一个按钮,其中包含可由用户按下或单击的图像(而不是文本)。

检测列表中任何元素的单击(android studio)

所以我正在 Android Studio 中开发一个应用程序,我正在制作一个功能,您可以将主图像设置为您按下的任何按钮上的图像。 要检查列表中的任何项目是否被单击,我正在尝试执行

回答 1 投票 0

Android 异常图像按钮

我正在尝试在我的 Android 应用程序中创建类似的主菜单设计,正如您在我的附件中看到的那样。 问题是,菜单按钮不是水平的,而是倾斜的并且每个按钮部分重叠

回答 1 投票 0

表格行中的按钮大小

表行中有 4 张图像: 我的表行中有 4 张图像: <TableRow android:layout_weight="1" android:gravity="center"> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="Icon" android:src="@drawable/ic_android" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="Icon" android:src="@drawable/ic_android" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="Icon" android:src="@drawable/ic_android" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="Icon" android:src="@drawable/ic_android" /> </TableRow> 为什么我得到两个大按钮和两个小按钮。为什么尺寸不一样? 使用 layout_weight 属性将空间平均分配给四个视图。请记住将 layout_width 设置为 0dp。 <ImageButton android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="4dp" android:layout_weight="1" android:contentDescription="Icon" android:src="@drawable/ic_launcher_background" /> 样本输出:

回答 1 投票 0

按钮上的图标

我有带有Android图标的ImageButton: 我有带有 Android 图标的 ImageButton: <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="Icon" android:src="@drawable/ic_android" /> 如何将此图标更改为“确认”。我想使用标准 Android 库中的图标。怎么做?我应该按照什么逻辑在标准 Android 库中找到所需的图标? 看来您是 Android 新手! 如果您想拥有更多功能,请使用材质按钮。 <com.google.android.material.button.MaterialButton android:id="@+id/confirmBtn" style="@style/Widget.Material3.Button.IconButton.Filled" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:text="Confirm" android:textAlignment="center" android:textSize="16dp" app:icon="@drawable/ic_android app:iconGravity="textEnd" app:iconPadding="8dp" app:backgroundTint="@color/green"/> 图像按钮只有一个图标,没有任何文字或标签。 您也可以使用 android <Button 标签,并将其 text 设置为“确认”。 <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableEnd="@drawable/ic_android" android:text="Confirm"/> 尝试将 <Button 标签更改为 <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton 并查看结果。 Android Studio 已经有一堆常用的图标。 获取图标的步骤: 右键单击drawable文件夹 选择新的并选择矢量资源 点击剪贴画并搜索所需的图标 选择您的图标并设置名称和颜色 完成 第1步: 第2步: 第3步: 第4步:

回答 2 投票 0

在xml中禁用按钮点击效果

我创建了一个简单的ImageButton在我的应用程序和IM使用和图像。我有喜欢,当我点击按钮,它不会显示它被点击(不知道它是如何调用,但当按钮...

回答 1 投票 0

在ImageButton中显示图像

我向ImageButton添加了一个图像,但是它没有显示。为什么?

回答 2 投票 0


一个图像按钮中有许多点击器

我有这张照片(这是一张照片,而不是四张)。我想使其成为一个图像按钮。但是,我想将其分为四个部分,所以当我单击Paul时,它将为我打开有关Paul的新意图,...

回答 1 投票 0

无法解析Android中ImageButton的ID

我有一个带有4个ImageButton的滚动视图。但是,当我在约束布局中定义约束时,我在XML文件中收到错误消息:“无法解析符号@ id / imageButton”。我会...

回答 2 投票 0

如何使用一个导航抽屉进行全部活动?

我正在构建一个仅使用活动的应用程序(因为我听说片段对于新的android用户而言太复杂了)。我试图将我的主导航抽屉应用于所有活动,而不是...

回答 1 投票 0



如何从“活动”返回主屏幕>>

[我知道当我按下Home键时,Android将返回主屏幕,但是,我希望我的imageButton充当Home键,这样可以将主屏幕通知前台。我应该如何...

回答 1 投票 8

Android Kotlin(Instrumented)测试,断言ImageButton具有正确的资源不起作用

我正在使用Kotlin开发一个Android应用程序。我正在为我的应用程序编写检测测试。现在,我在测试ImageButton时遇到问题,因为它无法按预期工作。我想...

回答 1 投票 1

设计难度,用于将ImageButton重叠在两个相对布局上方

我正在开发应用程序,对于它的设计,我需要在两个Reelative布局上方重叠ImageButton或将其设置为哪种布局。这是我在这里实现的设计...

回答 1 投票 -1

带有一组色彩动态绘画的Android图像按钮

我想创建一个非常复杂的按钮,但是现在当我面对它的更多技术问题时,我不确定如何创建它。我有一个带有自定义纹理的ImageButton(android:...

回答 1 投票 0

如何保存新的imagebutton图片并在重新启动时加载新创建的imagebutton图片

我试图在应用程序关闭时重新加载从图库或相机中获得的图像,在imagebutton中,我尝试将其保存到文件并从该文件加载,但是我无法将其保存到...

回答 1 投票 0

在发布模式下运行时,Android按钮ImageButton不显示图像

我正在尝试使用ImageButton来显示资源,.png作为可单击的按钮。当我在调试中运行我的应用程序时,ImageButton会正确获取图像。但是,当我在发行版中运行该应用程序时...

回答 2 投票 1

Android:“图像”按钮的页边空白

我的Android项目中有一些图片按钮。但是它们有一些像这样的图片空白边缘(我从真实设备上拍摄了这张照片):如何删除它们?我使用了这段代码,但没有任何...

回答 2 投票 0

单击时以编程方式更改矢量资产的颜色

我创建了以下矢量资产并将其插入到Imagebutton中。我曾想过,一旦单击它,心脏将变为红色,而单击后将变为透明...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.