android - Center a progress bar vertically -
I have a ProgressBar
inside a relative layout
and some Look at the elements with others and I am unable to focus progress bar vertically. I tried android: layout_centerVertical = "true"
, android: layout_gravity = "center_vertical"
, android: layout_gravity = "center"
, and < Code> Android: gravity = "center" but it will not work!
This is my layout:
& Lt; TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "random number:" android: id = "@ + id / lbl" Android: visibility = "gone" /> & Lt; TextView android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: id = "@ + id / rndNum" Android: layout_toRightOf = "@ id / LBL" Android: visibility = "Gone" / & gt; & Lt; / RelativeLayout & gt; & Lt; / Scrollview & gt; Edit : The progress bar, however, is being centered horizontally. Update: This is how the scene is being provided
Try it this way, hope it Will help you solve the problem. if If you want RelativeLayout then match_parent FrameLayout to take the form of the original layout of your scrollview and you put out the progressbar like the Side RelativeLayout below to install layout_height
& Lt; Android: layout_height = "wrap_content" android: id = "@ + id / rndNum" Android: layout_toRightOf = "@ id / lbl" Android: Visibility = "gone" /> & Lt; / RelativeLayout & gt; & Lt; / Scrollview & gt; & Lt; ProgressBar Android: Android: layout_heid = "wrap_content" Android: layout_gravity = "Android: Android: Progress =" Visible "Android: Android: Center" Android: Uncertain = "True" /> & lt; / FrameLayout & gt; & Lt; /android.support.v4.widget.SwipeRefreshLayout>
Comments
Post a Comment