Android progress bar with circular drawable and filling from bottom to top - java

I am currently working on creating a custom progress bar and have so far managed to get the correct image I want to display, however I am trying to customise it so that it fill the white space within my drawable from bottom to top (bottom being 0 and top 100). I am using xml layouts.
I am not entirely sure if this is possible, the image I am trying to fill is;
Any guidance as to whether this is possible or if there are any libraries I would use that would be much appreciated.

Related

android imageview come from over screen

hi.
I have a problem with android layout.
gif is what designer want I make. and I made things successfully but menu.
png(alpha image) is our menu image. last 40px of height is want to display.
and if user touch that 40px of image is coming down just like gif image shows.
I don't have any idea how can make that. Constraint Layout doesn't support negative value.
ps. png is based on 1080 height resolution. but I will add dynamic resolution calcaulator function, so don't mind about 40px. 40 just mean 'want to display part of imageview'
SOLVED.
make imageview in constraint layout xml and inflate it.
then you can set x,y location programmatically.
I confused it. because when I tried it, It doesn't work. you must know view has relative location.

Why do my buttons and other elements keep re-arranging in Android Studio?

I'm building a simple app for a game that has labels, textfields and buttons. Every time I try to run the app the elements on the screen keep moving around in the emulator even if they look find in the editor. Picture of layout
I've tried adjusting them by dragging and dropping and experimenting by changing XML. I think I'm missing something, but is positioning elements on the screen the way you want usually this difficult?
If you use lots of views in vertical direction use Linear layout, if more on horizontal use relative layout as you can position elements left-right or center w.r.t each other or parent easily, use a combination of both to get best results.

Custom Vertical ProgressBar in LibGDX

I want to create Custom vertical progress bar with non linear background
In previous implementation I used skin composer , but as I know it works perfect with simple regular shapes (the knob part resize on the all background image so it looks bad in my example ). I also try to hack using several layer behind the progress bar, but for this case the background behind progress bar is transparent.
I suppose this solution can solve my issue but unfortunately I dont understand how can I implemented that solution.
I also try to crop the inside part (that reference), whenever the progress is changed but I dont think that is the best solution (also the increase/decrase animation cannot be simple enabled )
Could you draw the full red progress bar and then load peices of it until it fills up the whole thing?
Here is a way to get pixels from a png image and you could wirrite your own parser:
How do I read pixels from a PNG file?
Or you could search Google for how to get peices of a png or bitmap.

Android: How to create a loading bar with text half one colour and half another

I've been trying to create a bar chart/ loading bar where the text is half one colour and half one another and have been struggling to come up with a simple way to tackle this. My ideas thus far have revolved around creating both bars in their complete state and then having a pair of 'selective transparency' views which would show the respective halves to create the effect.
I've been unable to find how to do this selective transparency/ opacity view. Is this possible? Is there some other blindingly obvious way to achieve this effect?
Here's a quick drawing of what I'm trying to achieve.
For anyone stumbling across this, I managed to solve this by using setClipBounds. I did it by creating two textviews of the full size, one with a coloured number and transparent background and the second with a white number and coloured background. Then setClipBounds is applied to the coloured textview as follows -
textview.setClipBounds( new Rect(0, originalHeight*(1 - progress), originalWidth, originalHeight);
Here, the variable progress has a value between 0 and 1. The Rect has to be defined relative to the view, not relative to the screen.
This exact setup achieves an effect something like this, but it could easily be changed to a horizontal bar or whatever else is required.
Somehow misinterpreted the question. The best way to achieve this would be to create the images and set as background to an imageview instead of a textview.
You could just use a LinearGradient
With the parameters colors and positions you can indicate the loading progress.
You can use the gradient when you override the onDraw Custom Drawing

Dimensions of an Android Image

I am creating a reference app which has a navigation bar at the top and the information, in the form of an ImageView, below it surrounded by a ScrollView. I have worked out how to change the image when the next button is pressed. I noticed this being implemented on the below app. I am able to get all the programming working, but I am not to keen on visual editing.
http://media1.android-apps.com/images/pname/com.ninjacoders.mcanary/image1.png
What should the dimensions of the Image be in Gimp?
How would I go about creating customs home screen buttons, and what dimensions should I use for them?
Any further advice on how I should do this would be greatly appreciated.
From within GIMP, you should zoom enough your image - and work with the "pencil" tool, and the "pixel" brush (the one brush right after the pepper brush - they are sorted alphabetically) - this will allow you to proper edit pixel-art images.
You can use teh colorpicker and create a new palette resort to let it easier to pick the few grey tones you are using.
To get to know the exact dimensions, one of the tools in GIMP's toolbox is the "measure" tool - use it to get to know which icon size you need.
As a final tip: do your work on this larger image, and draw the icons you want in separate layers - whenever an icon is done, crop its layer using the crop tool, with the option "crop layers" on (else it will crop the whole image) - and then drage the thumbnail for the image layer containing your icon from the layers dialog into the toolbox - this will create a new image consisting of the icon alone (and is a quite faster workflow than copy + paste as new image).

Categories

Resources