I am using API 22 and want to add shadows to my progress bar and toolbar, but my first focus is on the progress bar. Is it possible to do this? If so, how?
I tried using the shadow attributes, but those didn't seem to work.
Here is an example of what I want the progress bar to look like:
Link: https://i.stack.imgur.com/m1rd7.png
It has a nice slight shadow above and below it.
Currently I'm using a CardView with a child ProgressBar.
Related
I'm using ProgressBar in android for providing a progress bar. At the moment I have a common progress bar, like you can see in the attached picture at the top - just a blue bar. What techniques are possible to have a bar style with stripes like attaced in the picture? do I have to use an image with stripes as background for solving this? or do I have to provide a special "android:progressDrawable"? Thx for your hints.
Create a custom progressbar with your own drawable. look at this topic: Custom Drawable for ProgressBar/ProgressDialog
I am trying to create a seekbar with horizontal progress bar on thumb. Visually it should look something like this.
So when i seek the thumb left to right the progress bar will act according to the value of seekbar.
So far i had try to overlap a progress bar on the top of seekbar, but this is not working as expected. Also i am not able to pass the touch event from progress bar to seekbar. As progress bar is overlapping the thumb i need to bypass the touch event from progress bar to seekbar thumb, which i am not able to achieve it.
Can anyone help me changing existing code or completely create a new custom seekbar by extending base class.
If you don't want to code the wohle thing yourself, there is a github project that displays the value inside the thumb. However, this is not very similar to the image you provided, but maybe could be styled.
The other option is coding it yourself. You will basically have to extend SeekBar and override the most important methods ( onDraw, onMeasure etc. )
There are plenty of tutorials on how to make custom views, like this one from the android developer pages.
In my application I request a determinate progress bar using:
this.requestWindowFeature(Window.FEATURE_PROGRESS);
It works well but the bar does not span to the edges of the screen (see below picture). What could I do to fix this?
I compile against API v22 and I am not using appcompat.
I do not know for sure if this will resolve it or if it does, it is the perfect way to do it. I had a similar problem and i had used a negative layout_margin like below
android:layout_marginLeft="-22dp"
android:layout_marginRight="-22dp"
for the progress bar
You could try and see if this helps;-)
I need to develop a custom layout for the action bar in Android.
I'm now stuck because I have no clue how to calculate the available space for my custom layout.
In the image, the red part is my custom layout, the blue part is the space occupied by the action buttons.
Clearly I need to know/calculate the size of the red part to be able to correctly position the elements in my custom action bar (for example center the title in the window or make sure not to overflow in the blue part).
How can I achieve this?
I couldn't find useful examples or a clear API in the Android documentation.
I think that anyone using the custom action bar layout must be facing this kind of problem, I'm a bit confused.
Or am I supposed not to use action buttons in this case? Perhaps I'm supposed to replicate the action buttons by myself?
Thanks in advance
Try using ToolBar instead of ActionBar. It will give you a lot more control over ActionBar elements than ActionBar.
Here is a simple tutorial about how to replace ActionBar with ToolBar and how you can customise it.
Material ToolBar
Possibilities are endless with ToolBar but my recommendation is to don't overdo anything.
As per my suggestion try to use the entire action bar by your custom layout. So that you can arrange all the things use it as a fragment inside a framelayout for all your screens so that the code can be reused for all your layouts.
I am using an Action bar in my project. I am displaying a progress bar via the below approach.
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
However, what I'd really like to do is replace the left most image icon with the progress indicator when arbitrary background processes run and then returns the usual icon when complete.
Can anyone tell me the steps needed to replace this icon with a functional Progress indicator. It only needs to be an intermediate one.
Looks like you can find some suggestions here: Android: dynamically change ActionBar icon?.
Specifically, you can access the icon by using
Activity.findViewById(android.R.id.home)
And then just set and re-set the icon as needed.
You need to build a custom layout for this and use actionbar.setCustomView(yourcustomlayout);
In your custom layout have an imageView(which is your app icon) and progress bar(initially which is set to invisible).
When running the background process just set the visibility between image view and progress bar.