Answer the question
In order to leave comments, you need to log in
Problem with RelativeLayout, how to solve?
The problem is that the elements in the Relative Layout do not want to be centered horizontally, even if the property layout center horizontal = true, the Relative Layout is nested in the Scroll View.
Help, I will be very grateful
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</ScrollView>
Answer the question
In order to leave comments, you need to log in
This is because you made the RelativeLayout the size of the child(wrap_content). Naturally, in this case, the child is always "in the center" of this layout. Set the width of the match_parent RelativeLayout.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question