Invisisble background for Spinner? - java

I am trying hard to have a Spinner look like Textview meaning the displayed selection should have no frame or color or transparency, I would like just the displayed value text and nothing else. I have been playing with .9.png files and gimp but haven't made headway. is this possible?

I took the btn_default_normal, opened it in gimp and erased the button leaving the boundry markers and I had an invisible background! works like a charm but the battle continues.

Related

Combining TextViews + Image to make a full Image/file

I have been asked to design an app that allows the user to take an image. At the top of the image there should be data such as imageNo and workOrder.
At the minute, I have two TextViews at the top of my activity, an ImageView below and then a green button at the end like so:
ImageScreenshot
When I click the green button I would like to send this full screen, textviews and image all as one file/image to a destination - like a screenshot.
Is there any libraries out there or does anyone know how I could achieve this?
Thanks!
https://www.youtube.com/watch?v=sPvCEsGm8us
check out this tutorial, I think it covers the basics of the question you asked. I automatically thought of this reference as I read your query.

Android "Frozen" Button appearance

I have a certain problem: I have created a quick clicker game, where two players try to click quicker than the other one. A special button freezes the opponent's main button. The frozen button currently only becomes unclickable and its text color becomes gray.
To add some "style", I would like to literally freeze it. I don't really know how it would look like, but I thought about a light blue background, and some light blue spikes around it or something like that. I haven't found any style that would do that, and any image to replace the button with, because "Frozen" finds other images ;)...
I'm not a designer so telling me that tools that can design buttons exist won't help me.
Also, just an image won't probably be enough, because the button can be frozen at any moment, with any text and any text color.
Thanks for your help.
You can create button look (drawable) and set it programmatically.
Example
myButton = (Button) findViewById(R.id.myButton);
myButton.setBackgroundResource(R.drawable.frozenDrawable);
To do some simple looks for buttons i recommend you
Android Button Maker
.
Example 2
For more advanced look you can create some png
ImageButton myButton = (ImageButton)findViewById(R.id.myButton);
myButton.setImageResource(R.drawable.frozenResource);
I don't have code, but here is what I would experiment with, if I had to create create the appearance of a frozen button while keeping its text and general appearance:
To ice the button:
Using Google Image search, find the image of a slab of ice
Create an imageView with that "slab of ice" image as the src, and make it about the same size as your button (or slightly larger if you want the ice to leak out)
Place that icy imageView directly over your button.
Make that imageView slightly transparent by setting the "alpha" property to 0.5 (or whatever looks good, keeping in mind that 0 = invisible and 1=fully visible).
To unfreeze the button:
Make the imageView invisible.
Re-enable the button

How can I change the layout of a dialogFragment when a softKeyboard is opened?

I've got a quite big dialogFragment, with 5 editText's, and some text, to explain what should be filled in. This dialogFragment fits on the screen perfectly fine, until the keyboard is opened. To compensate this, I would like to hide/remove the explanatory text while the keyboard is open.
The text is shown in a textView and in the dialog's message.
I know it's not simple to do something when the keyboard is opened/closed, but with some hacks, I hope it's doable.
So: How can I change the layout of the dialogFragment based on the state of the keyboard?
Click either image to view a bigger version
Also, as you can see in the second image, the clock / icons in the notification area (or whatever it's called these days) are showing through the dialogFragment. It would be lovely if that could be prevented too, for learning purposes, but that's not the most important part.

How can I prevent a CodenameOne GUI Element from scrolling (tickering?) when it changes to Bold?

I am building my first CodenameOne app using the GUI Builder. I've defined a style for my buttons where the "unselected" state is regular text and the "selected" or focus state has Bold text.
The problem I'm seeing is that once a button gains focus, the bold text is slightly wider than the original text and it starts scrolling (I think the effect is referred to as "tickering"):
Unselected Button Image
Selected Button Image
I see this in the simulator and on my Samsung SG6 testing. Is this a bug or is there something I can do to pre-size it for the bold text first so it doesn't start scrolling when it gets focus? I don't want to make the button larger than it needs to be (ie: fit it to a container)
You need to do 2 things,
first reduce the left and right padding of the selected button UIID and then call this in your code
mybutton.setEndsWith3Points(false);
mybutton.setTickerEnabled(false);
As an extra, place the button in a container with the right layout.
Note that since the text is now Bold, it's normal for the button to gain extra width. So I will suggest you make a room for that.
Edit:
I noticed that the button was tickering when you took the snapshot so ignore the first point about padding.

How do you remove the selection box in the GUI?

In any program, or at least most, when you select a button or anything, there is a selection box made of lines which are made of dots.
How do you get rid of that box?
The reason why I want to do this is because I have a button with an image, no contentFill, no borders, and it looks very awkward when selected.
Make the button or component non-focusable by calling its setFocusable(...) method:
myButton.setFocusable(false);
Edit
... or maybe even better:
myButton.setFocusPainted(false);
This way the component can still get the focus if need be, but just doesn't show the focus border.

Categories

Resources