I've an ImageView that serves as the background of the image and at the same time a preloader horizontally and vertically aligning in the center of the screen. I managed to center the progressBar but wasn't able to offset it slightly above using margin.
Some people suggested to use linearLayout and control using android:layout_weight, however it doesn't work for me as I need to apply my image as background and hence the relativeLayout...
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="#FE6869" android:weightSum="1"> <ImageView android:src="@drawable/splashscreen" android:scaleType="centerCrop" android:layout_width="match_parent" android:layout_height="match_parent" /> <ProgressBar android:id="@+id/loading_spinner" style="@style/Widget.AppCompat.ProgressBar" android:layout_width="65dp" android:layout_height="65dp" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_marginTop="170dp" /> </RelativeLayout >
No comments:
Post a Comment