How to make TButton as transparent in Firemonkey - android

I am using Delphi XE6. I have home screen of Android App. The Home screen contains Tbutton(s) with TImage(s) on top. I need to make TButton transparent and get rid of border of TImage.
I tried with Opacity property of TButton. But, the property is making even Image as transparent.

You can use only ImageView instead of Button and can perform action on image click..So you do not have to make button transparent.

You can use a Trectangle, it's work good on Windows and Android, no use a lot of resources.
You can apply a fill property to make it Transparent, you can also using a OnDraw method to copy a transparent bitmap to the canvas.

Related

Layered button with transparent icon in Android

Is it possible to make layered button in Android with transparent icon throgh first layer? It looks tricky, I could make different assets but is it possible to achieve it programmatically? Example below
EDIT: Icon has no background, only border.
Seems easy enough. Save the icon as a .png file, such that anything besides the arrow outline is transparent. Then it's a simple matter of drawing one ImageView on top of another ImageView, depending on what you want.
In order to tint the arrow, use a TintableImageView as described here.

Android: strecthing background

I want to have a gradient on my app background. The picture is only ten pixels wide and I would like it to repeat horizontally. Then I have the background set to the color where the gradient ends vertically. In CSS I could easily do this by this code:
background: url("bg.png") repeat-x #0f0f0f;
But I have no idea how to do this on android. I tried setting a bitmap but everytime I put it in the XML the app force closes on me and there doesn't seem to be "repeat-x" like option on it.
So what would be the best way to handle this?
you can use bitmap shader to repeat a particular bitmap .
Refer to this link
Also check this Api Demo Example

Android Transparent png doesn't show as transparent

I'm using an image with transparency as a ImageButton in my Android app - but when it appears on the android screen - it still has a whitish surrounding border.
I even changed the image to one of the template ones supplied and that still is not transparent (although it is in photoshop).
Am a missing some declaration or something ?
I tried in both the emulator and also running on my phone and its still shows as white on the black background.
Cheers
ScottyB
The whitish color IS the button part of the image button :)
Use regular Button and set your image as the android:background of it. Don't set any text.

Transparent PNG image not looking nice

I have an image that has a fairly large shadow around it and its background is transparent. I have saved it as a PNG file from photoshop and am using it in an ImageView through xml. This results in the shadow having a banding effect and just doesn't look nice. Not too sure what to do...
Just add
// set 32 bit window (draw correctly transparent images)
getWindow().getAttributes().format = android.graphics.PixelFormat.RGBA_8888;
in onCreate(...)
http://www.curious-creature.org/2010/12/08/bitmap-quality-banding-and-dithering/
I can't remember what this property was used on, but I think it was an ImageView.
Try using android:dither="true" as part of the ImageView xml declaration and see if that helps.
I can't remember where I read it, but on the developer site somewhere there was this suggestion for fixing gradient banding; it might help with the shadow as well. Right click the effects icon on the layer that has the shadow, and click "Create Layer" to make a separate layer for the shadow. Then apply an "Add Noise..." filter to the layer with the following settings:
(in case the image ever disappears, Amount:0.5%, Uniform, Monochromatic)

Does changing background color in android destroy the widget's appearance?

I've noticed that changing the background color of an android widget (ex. Button or TextView) by program:
myButton.setBackgroundColor(Color.BLUE);
makes it to loose its 3D shape, border, and shadows effects, and then appears like a ugly flat square. What am I missing?
Sorry for the very naive question but I couldn't get it right although tried for a time.
Rounded corners, shadow effects, etc are often accomplished in Android by using images. See this developer documentation for an explanation of how that works.
A widget can have either an image background, or a solid color background. So, by setting the background color you are override the background image. If you want to change the color without losing everything else, you need to edit the image files.
See:
How to set background color of a View
Is it possible to have a Button with a background image with text on top?
How to gradient fill a button's background?
Problem with EditText background (android)
Since background is a drawable, you can modify the drawable to change the color:
myButton.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);

Categories

Resources