Skip to content

Instantly share code, notes, and snippets.

@sharifulislam52
Last active July 8, 2018 09:43
Show Gist options
  • Save sharifulislam52/a086f3bea52e7595745d4d46cf6fda17 to your computer and use it in GitHub Desktop.
Save sharifulislam52/a086f3bea52e7595745d4d46cf6fda17 to your computer and use it in GitHub Desktop.
Write android view center of screen
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:layout_centerInParent="true"/>
</RelativeLayout>
<!-- ----- -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- center views -->
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment