Replies: 3 comments 15 replies
-
This is something that has come up a few times - see this issue for at least one of those discussions. The short answer to your question is that this isn't currently possible. It's been proposed in PR #1213, but I'm still not sold on the use case. The underlying question is why do you want this? If what you want is a button with an icon, then we don't need an image that supports on_press - we need to support icons on buttons. This is something I can definitely support - and at some level, should already be possible by using unicode in the button label. A button is very different to an image. An image is a picture, of arbitrary size. There might be a valid use case for making the image clickable - but being able to fake a button isn't that use case. |
Beta Was this translation helpful? Give feedback.
-
My apologies - I think we've got some crossed wires here because of terminology. In Toga's terminology, what you've described are icons, not images. Although it might not be obvious, there's a very important distinction here. Icons are:
Images, on the other hand, are:
Using the "official" app as an example - the start/lock/unlock pictures are icons. The picture of the truck is an image. As a result, the APIs that we provide for icons vs images can be very different. What you've described - putting a "settings" or "refresh" icon on a button is (to me) an entirely reasonable use case, and one that we should definitely support. The app you're describing looks like a really solid example of where you'd use them (and, as an aside - the app itself seem amazing!). We sorta-kinda have support for this right now - in the form of using the icons that are available in Unicode (such as the Media Control symbols) - however, those aren't a great solution; I'm only suggesting them as "something that will definitely work right now" because you can treat the icons as "text labels". What I'm "resisting" is the idea of an image button. The reason for this is somewhat philosophical - I'm utterly sick of UI designers reinventing the wheel. Platforms have UI design guidelines for a reason, and consistency is something that aids user experience. Take the screenshot of the official app that you've provided. Based on the visual language, it's very difficult to know for certain what is and what isn't a button - because the design language is completely inconsistent. I'm guessing the big start icon is a button - they've used shadows to try and develop some sort of skeuomorphism that makes it look like a Big Button You Can Press. However, that skeuomorphism is inconsistent with the Android style guide... so that leads to things like the "24x7 assistance" pictogram. Is that a button? The design language isn't consistent with the other buttons on the screen, so how is the user meant to intuitively know it's a button. What about the "F-250 XLT F4 v" text? Is that button? Is it all a button, or just the down chevron? Who knows? The design language doesn't tell you. What about "Find a dealer"? I presume that's a button as well? What about the picture of the truck .... is that a button? Who knows? So - Ford has built a UI that has 3 (4?) buttons... and they're all different - WHY? Now, I'll grant that in this specific case, you might say it's not that big a deal. However, I've lost count of the number of times I've seen UIs where users literally don't know that something is a button because A Designer Has Designed The App; and while it may be "pretty" (for some definition of pretty...), how the app is actually meant to function is completely opaque. I've seen users completely surprised that a specific feature or functionality is available at all, because the fact that one particular "image" was actually an interactive element wasn't obvious. What I'm trying to do with Toga's APIs is make it easy to do the right thing - which means being consistent with the platform style guide. That means buttons look like buttons, and behave like buttons. Depending on the platform, a button has an edge indicating how big it is, some contrast to show how big the pressable area is; simple text or an icon, and maybe a little shadow to give the visual impression that it can be pushed. An image is a picture. And while, yes, you can make the picture look like some sort of button - just because you've got a hammer, doesn't mean you need to treat everything like a nail. When someone says "I want an image button", the question I ask is "do you really want an Image button, or do you want an icon on a button"? And, in my experience, the answer is almost always icon. I'm 100% on board with supporting Icons on buttons. We don't have support for them yet, but I'm not opposed to adding them. Internally, that might end up being implemented on Android using As for "begging" - well, I can tell you what features we have right now. I can also tell you that this is a volunteer-based Open Source project, so that addition won't happen unless someone volunteers to add it. |
Beta Was this translation helpful? Give feedback.
-
There is a possibility to make an image(!) "clickable" by using code from an active pull request. it does NOT behave like a button (= change color on_press() ) !!! I myself do NOT think an image on a (typically small) button to make much sense, btw: |
Beta Was this translation helpful? Give feedback.
-
Is there any way to make a button, that instead of text, display a icon or image? (That will work on android)
Im looking for a way to get a "on_press" event from a icon or image
Beta Was this translation helpful? Give feedback.
All reactions