I want a ProgressBar that is touching a bottom border of screen but with this piece of code, I am getting an little space between bar and screen border:
I have been struggling with this for a while now. My conclusion: There is no way to archieve this behaviour with XML for arbitrary screen sizes. On some screen sesolutions the progress bar will always be misplaced a little.
My simple solution: Set the Y of the progressbar programmatically to the Y of the super view/layout
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
progressBar.setY(layout.getY() - progressBar.getHeight() / 2);
}
Works like a charm and for all screen sizes.