I want to change pixel color via android application using background.
It means entire screen, not image file.
How can I modify pixel color?
Result of searching, I could find "Bitmap", "Surfaceflinger", "Framebuffer".
but, I don't know what is correct way.
The concept SurfaceFlinger and Framebuffer is a low level concept in Android system. In application level, which built on framework, these concepts are opaque.
As Bitmap, it's not very necessary if you just change the background color.
You can just simply do like following in your Activity.
getWindow().setBackgroundDrawableResource(R.color.color_res_id);
// or change the root view background
getWindow().getDecorView().setBackgroundResource(R.color.color_res_id);
If you are novice in Android app development, you can start reading the training here, it's a good source for beginner to start.
Related
I work with FireMonkey in C++Builder, and I'm trying to make a transparent form, so that the components that are on it are displayed, but in the space where there are no components you can see what is below the form (transparent)...
I have set the Transparency property of the form to true, but the areas of the form that should be transparent look BLACK.
I have searched the Internet and found solutions for Delphi, but none for C++.
I tried to include this in the manifest:
SetActivityAttribute(MYFormTransparent ,android:theme, #android:style/Theme.Translucent.NoTitleBar)
but still, the same issue.
Any ideas?
This is a known problem that was introduced in 10.3 Rio. It has already been reported to Embarcadero (unfortunately, it has been closed as "works as expected"):
RSP-22314: Transparency Property
Marco Cantu commented on that report:
Sorry for not commenting sooner. We have done some research on it for the last update, but decided to defer a fix.
The core issue (in short) is that we use Android SurfaceView and this is a limitation of that platform control (only 2 SurfaceView instances are available). We are using this platform element as it allows us to mix styled and platforms controls (a feature we introduced in 10.30). By chancing the internal implementation, the transparency become unavailable.
There is an alternative implementation of forms via TextureView, but so far our tests have shown that the speed of rendering 2 times slower, and we don't want to slow down all FMX applications on Android for this feature.
There are some workarounds, one of them is to use a frame instead of a form. It works perfectly with transparency and uses less resources than separate form.
For existing code the fast way is to add a Layout to the form and have the controls inside it. When you need to display the form with transparency you can just move Layout from the specific form to main form as a child and align it on content Align = Content.
Other commenters noted:
I tested an alternative with formStyle = popup and stylelookup = popupboxstyle
with a rectangle in the form with transparency = 0.4 and some instructions to size the form with setBounds
The result is acceptable
As said by Herve Escriou, a work around is to set your formstyle property of the form to "Popup". This will make the form transparent again. But this wil have the effect of the wsMaximized style not working properly. You can go around this by making the following code additions to your form: ...
I just swapped my android launcher icon(just learned how). I noticed MANY icons on my android are circular and I am wondering do I have to get an image done like that OR is there way I can have the launcher put the icon(a png with transparent background) and draw a circle for the launcher somehow? (this would be easier that fooling around in some drawing tool as well).
In the app I used CircleImageView for contacts which did the circle but that was in java, and android launcher is xml so not sure if I can use CircleImageView?
You'll need to use adaptive icons instead of a single image to allow Android to adjust your icon. Essentially this is defining a background drawable and a foreground drawable, and Android will do the rest.
If you right click your res/drawable folder in Android Studio, then select New -> Image Asset, you will see the following wizard. This will let you easily create launcher icons that work in all shapes.
For further information you may find the official Android docs helpful, as well as Nick Butcher's excellent guide.
I would like to determine the color of something on my screen that is part of my app, such as the background color of an activity. The only solution I can think of is to take a snapshot of the screen and then inspect it with a graphics app. Is there something built into Android or Android Studio that lets me inspect the color of something on the screen to determine it's RGB value?
NOTE: This is strictly for debugging my app. I don't need something to integrate into my app. I need a tool to verify what the colors are on screen.
Try this lib to obtain color from view in RGB ("#" + envelope.getHexCode()): https://github.com/skydoves/ColorPickerView
I have created some images and set some colors using photoshop and applied them to our app in android studio, but for the same hex code, colors arent same, I do not understand why this is happening. I took a screen shot of the color im working in photoshop and then opened the image in photoshop, surprisingly the color code changed, and it was same as android studio was showing and its not the actual color, I have even checked the RGB/ CMYK mode, it is in RGB mode, i even tried CMYK mode, in the both the cases the problem persists. No matter how many times i have tried, the problem persists. Please help me out
I agree with Rodrigo, you should set a color workflow.
If you are mainly working on documents viewed on the web or mobile devices :
1) in Photoshop go to Edit>Colors Settings and set your RGB Colorspace to "sRGB".
2) Make sure Proof Colors is unchecked in the View menu.
3) Make sure your document has the "sRGB" color profile attributed (can be fixed by using "Attribute color profile" or "Convert color profile" in the Edit menu).
This should ensure color consistency across most devices and web browsers.
It very strongly depends on device screen. I have 4 devices, and colors are different on all of them
You have to setup your color profile in photoshop, by default photoshop gives you different colors when you save for web. Check out this tutorial step by step and let me know if this fixed your problem.
http://viget.com/inspire/the-mysterious-save-for-web-color-shift
I am relatively new to Android development, and am developing an application with an image for a background. I need the ability to have text reliably and precisely placed in relation to certain points on the background image. I developed the application debugging on a Droid Charge. Everything looks fine there. However, I downloaded the application to a Droid X, and the text is a little off. I imagine I am missing some fundamental understanding about Android development, and would appreciate any help. Also, I believe this person is having a similar problem.
Screen sizes and precise element placement on Android
Well you need to understand that due to support of multiple screen, it's not wise to have a certain points or coordinates to draw your Views. If you want to draw a text according to a background position, then may be you should use a custom View where the background picture can work as the Background of your custom view and then you can place the text at the exact location.
Another idea would be to use a 9 patch drawable which is not stretchable (Background uses 9 patch drawable which stretches on changing the size of the view). However you have to supply different drawable for different screen densities then. I'd choose the first option, as it's easier.
PS: Tell me in comment, if you find any difficulty on applying any of the option.