Android "Frozen" Button appearance - java

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

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.

Adding a 'Minimize' button to JTabbedPane Tab Bar

I've searched extensively to solutions for this but haven't found anything that really achieves what I'm trying to do, the closest thing I could find was the solution posted at the bottom of this thread: http://www.java-forums.org/awt-swing/12267-how-add-jbutton-tabbed-pane-headder.html .
However because the JTabbedPane I'm using is inside a JSplitPane, it's size can increase/decrease, so using that solution doesn't work as the button stays static.
Below is an image of where I would like the place the component, similar to how eclipse has a minimize button on it's pop out views.
Is this possible without creating a custom JTabbedPane component?
Do you really need this button to hide?
Why don't you set splitpane.setOneTouchExpandable(true);?
With this line you can hide the bottom with an arrow of the splitpane.

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.

Ripple effect over colored ImageButton?

I have a dynamically created ImageButton. Here is my code -
ImageButton bar = new ImageButton(this);
... //some code
parentView.addView(bar);
Ripple effect appears when I click the ImageButton. But when I add the following line -
bar.setBackgroundColor(Color.RED);
The ripple effect doesn't appear anymore. Is there any way to make the ripple effect appear on a colored ImageButton?
By ripple effect, I mean this effect - click here (I'm sorry but I cannot add the image here as gifs are not supported)
Maybe try something like this:
bar.getBackground().setColorFilter(Color.RED, Mode.MULTIPLY);
You need to check what MODE would be apopriate, because i don't have big experience with this.

Invisisble background for Spinner?

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.

Categories

Resources