I have map's fragment, and a linear layout inside it.
I've tried: android:gravity="center"
but it didn't work.
I've also searched in the xml for keyword of "layout" and "center" and didn't find suitable solution.
How can I solve it?
This is the code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/common_google_signin_btn_text_light_pressed"
tools:context="com.dji.GSDemo.GoogleMap.FlightActivityUser">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_flight_user"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="@+id/flight_user_toolbar"
tools:context="com.dji.GSDemo.GoogleMap.FlightActivityUser" >
<LinearLayout
android:id="@+id/ratingLayout"
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:background="@color/colorPrimary"
android:layout_height="wrap_content"
android:visibility="visible">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:text="How was your flight?"
android:textSize="20sp"
android:textStyle="italic" />
</LinearLayout>
</fragment>
</RelativeLayout>
Thanks
gravity property affects to the content inside the layout, to align the layout itself you should use layout_gravity