507 questions
0
votes
0
answers
43
views
How to change shadow color (glowing shadow) in ImagButton in Android studio?
I want to implement a glowing shadow like in the pic.
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:...
1
vote
0
answers
44
views
How to do Song Track list with fragment in Android Studio?
I'm new in android studio, just learned about a week. Before this project , I made a simple SongTrackList using main activity with no fragment, it can run smooth (click ImageButton , audio works). Now ...
0
votes
1
answer
54
views
Android unusual Image Buttons
I am trying to create a similar main menu design in my android app as you can see in my attachment.
The problem is, the menu buttons are not horizontal, but are oblique and partially overlapping each ...
-1
votes
1
answer
64
views
Detect onclick of any element in a list (android studio)
So I'm working on an app in Android Studio and I'm making a feature where you can set a main image to the image on any button you press.
To check if any item in the list is clicked I'm trying to do ...
0
votes
1
answer
58
views
Android ImageButtons with Pressed State Not Showing
I'm facing an issue with my Android app involving ImageButtons. I have implemented selectors for the pressed state of the buttons, but the pressed state effect is not being displayed when the buttons ...
0
votes
1
answer
28
views
Button size in table row
I have 4 images in Table row:
<TableRow
android:layout_weight="1"
android:gravity="center">
<ImageButton
...
0
votes
2
answers
396
views
Icons on button
I have ImageButton with Android icon:
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
...
0
votes
1
answer
40
views
Listview not clickable when adding an ImageButton (android - xml)
I have a layout for a listview item.
I added an ImageButton to the layout, as follows:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://...
0
votes
1
answer
52
views
Adding Image button after Add button is clicked (Android Studio Java)
Is it possible in Android studio to produce an Image Button after I clicked a button like Add Button. If yes, how? I want to make an attendance app wherein if the user clicks Add Class an image ...
0
votes
1
answer
235
views
Change Tint Image Button after pressed
I am trying to create an ImageButton able to change the icon color after pressing. I want to do that in my XML file. I have the following code:
...
<ImageButton
android:id="@+id/...
1
vote
1
answer
37
views
ImageButton set to be visible after double click becomes invisible after app restarts
I have an imagebutton in my xml layout file that is initially set to "gone", but once a user performs a double click it becomes "visible". However if the user were to close the app ...
1
vote
1
answer
714
views
How to flip camera with imagebutton in kotlin [duplicate]
Hey there I want to flip my camera with an image button (e.g. btn_switch_camera) from back to front and vice-versa, help me!, this beautiful code has all basic things but no camera flip option so I ...
0
votes
1
answer
50
views
ImageButton stops working after 1 use Android
So hear me out, I used a button to open an activity which generates an item which will then be returned to the original fragment and will be displayed in the recyclerview... but once I try to add a ...
0
votes
0
answers
171
views
ImageButton tint selector is not changing color based on state
I want to change ImageButton icon color tint based on Button state. Its working with background for generic Button, but for ImageButton icon, its not working at all. Its still in "enabled" ...
0
votes
1
answer
476
views
Pass Date from Datepicker to Spinner selected item and load API Response in Fragment
I have a working app where user select an option from Spinner the datepicker auto open user select the date and view data. However, I am trying to include an Imagebutton(calendar) which opens a date ...
0
votes
1
answer
303
views
Referencing multiple buttons efficiently in Kotlin
Hey I'm just a week into Kotlin but I'm struggling with something now. I got this list where I want to put 20 ImageButtons in efficiently with not writing everything individually. I gave all ...
0
votes
3
answers
530
views
Crop imageButton in the shape of the background android
As you can see in the image, the ImageButton has the background of a "settings icon" but it's considered a rectangle. I want it to be cropped in the shape of the icon so the ripple effect ...
0
votes
3
answers
1k
views
How to set an ImageButton background color to a specific color of a theme that could be adapted to the night mode?
I want to find a way to set the background color of an ImageButton to a color that I defined in my themes and which changes with day or night mode.
Is this possible?
Here is the color that I want (...
0
votes
0
answers
268
views
startActivityForResult is deprecated for imagebutton to choose photo from gallery [duplicate]
//Example of ImageButton in the old way how it was handled
img_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ...
0
votes
1
answer
284
views
how to set an image to ImageButton background programmatically
I'm coding with Kotlin for Android app. I need to add an image for ImageButton background. I tried ImageButton.setBackgroudResource and ImageButton.setImageResource methods but it would not change.
My ...
1
vote
0
answers
108
views
How to spread children that display an XML shape evenly in a GridLayout (with maximum possible size)?
Here is what i want:
I have a GridLayout inside of a ConstraintLayout, to which I add multiple rows and columns of custom ImageButtons (BoardCells) dynamically.
The ImageButtons display circles using ...
0
votes
1
answer
157
views
Comparing drawables imageButtons in android
I have 6 image buttons with drawables, I'm trying to compare them using getDrawable().
Here's my xml code
'''
<
?xml version="1.0" encoding="utf-8"?>
<androidx....
0
votes
1
answer
42
views
Android ImageButton event does not execute all actions upon first click
I have a button to delete all data on my activity screen (a chart, database data and a textview) and to display a toast.
Pressing the button does everything apart from getting rid of the textview, ...
0
votes
0
answers
602
views
Android Espresso check ImageButton background color
I´m new to Android Espresso testing, and in my application I have some ImageButton views that I would like to test their background colors but I could not achieve it by any means.
I tried using ...
0
votes
1
answer
480
views
How can I put ImageButton in Fragment that will lead to another activity when I clicked the Image Button
I'm trying to make my ImageButton to change into another activity when I click the button but I do not know how can I be able to do that on a fragment page.
XML code:
<?xml version="1.0" ...
0
votes
1
answer
484
views
Button needs to get clicked twice
I want to get familiar with Android and started taking some Udacity courses. Currently, we have to make an ImageButton play some audio on click for language-learning purposes.
I thought it would be ...
2
votes
1
answer
120
views
How can I remove white spaces around an ImageButton?
How can I remove the white spaces around these ImageButtons?
This is sample code for one one of the ImageButton:
<ImageButton
android:id="@+id/imageButton3"
android:...
0
votes
0
answers
215
views
Android Action Menu "actionViewClass" Doesn't Work
I use built-in icon for the action menu item:
<item
android:id="@+id/first_refresh_item"
android:icon="@drawable/refresh"
android:title="Refresh"
app:...
0
votes
1
answer
55
views
Multiple drawables on a single ImageButton
I need to add multiple drawables on a single ImageButton. Probably the answer is, it is not possible.
But still, any ideas on what kind of approach should I follow to implement this kind of ...
0
votes
1
answer
265
views
Android Button.setActivated() dosen't work when the activity onPause and onResume again?
I am trying to make togglePlayPause button for media player.
first I made a play_pause_toggle.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http:...
0
votes
0
answers
58
views
setOnClickListener crashes the app - Android
I've 3 activity in my app. I set setOnClickListener on all the imagebutton in all the 3 activity. When I run the application and on clicking the first button in the first activity the app crash, but ...
0
votes
2
answers
771
views
need a round imagebutton which clips the image in a circle
I need a round image-button which clips the image in a circle, but this is what I get->(see the bus image)->bus image
I have given the description of Imagebutton xml and shape xml. The image is ...
0
votes
2
answers
368
views
Why is my circular ImageButton not working?
I'm trying to create a round circular image button in Android. I don't want to use CircleImageView because its scale type is centerCrop and you can't change that. I want my scale type to be fitCenter ...
0
votes
0
answers
52
views
Problem with fragment and buttons in my android app
So, I recently started with android coding. I don't know if I'm asking this question in the right forum or in the right way. I am new to coding and to forums. So forgive me if I'm not doing this the ...
1
vote
1
answer
574
views
Android - onClickListener not working for ImageButton in CardView
I have searched StackOverflow for similar questions and I have followed the instructions described there but I'm still not being able to make my onClickListener fire for my image button. Can someone ...
1
vote
1
answer
112
views
Arranging buttons with android: get rid of vertical space
I am new to android. I know layouts mainly from LaTex, but also at a layman's level from Swing, SWT and javafx.
As an exercise, I have tried a very simple layout for a calculator, which essentially ...
0
votes
1
answer
55
views
how to change a imageButton and check the state
I have a play/pause and a like/not liked button. I believe how it should work is that I check the state of the image button and whatever it is not when it is pressed it should change the image. the ...
0
votes
1
answer
229
views
Does a MaterialComponents ImageButton exist?
I am converting my app from AppCompat to MaterialComponents.
I have come across an issue that there is no theme under Widget.MaterialComponents. that applies to ImageButton.
Here is an example of one ...
2
votes
1
answer
153
views
ImageButton does not resize the image
Why ImageButton does not resize the image?
<ImageButton
android:layout_width="250dp"
android:layout_height="250dp"
android:background="null"
android:...
1
vote
2
answers
44
views
need text below imagebutton
I have a Imagebutton. I want text to be displayed at the bottom of the image. so, i created a Frame Layout. I placed the imagebutton and a text view inside that. But when i run the code on device, the ...
1
vote
1
answer
127
views
keep button drawable image dimensions as original
I created an app where I use Google Books API in it.
As part of the attributions they require, I need to add to each query results the following button:
Now, I wanted to use that Image as a ...
0
votes
0
answers
44
views
Java Android Studio Layout - ImageButton position accordly with xml background
First of all I'm quite new in layout development so sorry if this is a noob question.
I'm trying to create an xml with a sort of an interactive background. So I put a background picture and added some ...
1
vote
1
answer
100
views
How to customize the ImageButton style?
I am making a numeric keyboard.
keyboard appearance
I have a problem with the decoration of the return button.
If I use ImageButton, then I get an indent from the top, as in the picture:
button ...
8
votes
2
answers
20k
views
Object is not abstract and does not implement abstract member public abstract fun onClick(p0: View!): Unit
I haven't found anything over the past day that shows how to do this action, everything I've seen is with a basic button of which I am unable to replicate for use with an image button. using ...
0
votes
0
answers
73
views
Setting the correct parameters for a TableLayout
I would like to have a scrollable Table Layout in Android. For that I use the following XML layout file:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android=&...
0
votes
1
answer
336
views
Stop ImageButton tooltip from appearing on hover through a fragment
Currently I observe a strange behavior of showing a tooltip "through" a fragment and I have no idea how to get rid of it. Any idea or hint would be appreciated!
I have an ImageButton with ...
1
vote
1
answer
243
views
Can android:buttonStyle and android:imageButtonStyle be used for Theme.MaterialComponents?
For Theme.AppCompat, one can use android:buttonStyle and android:imageButtonStyle to style Button and ImageButton respectively for all activities. They do not seem to work for Theme.MaterialComponents....
0
votes
2
answers
412
views
Not able to set setImageResource for ImageButton
I am trying to set the ImageButtom.setImageResource() without being clicked.
When using onClickListener it is working.
Something like this :
Key.setOnClickListener(new View.OnClickListener() {
...
1
vote
0
answers
99
views
Android home screen widget: Can't change ImageButton image resource
I am trying to change ImageButton image source of a "AppWidgetProvider" from a service app by broadcasting a message. From service "updateAppWidget" method is called properly but "R.id....
-1
votes
2
answers
59
views
Showing Image in ImageButton
I added an Image to ImageButton but it doesn't show.why?
<ImageButton
android:id="@+id/next_button"
android:layout_width="105dp"
android:layout_height="53dp"
...