Skip to content

Instantly share code, notes, and snippets.

@Razeeman
Created July 31, 2019 08:03
Show Gist options
  • Save Razeeman/acfa7330822a53cbffdb4ab062f77373 to your computer and use it in GitHub Desktop.
Save Razeeman/acfa7330822a53cbffdb4ab062f77373 to your computer and use it in GitHub Desktop.
Bottom margin in ScrollView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background">
<FrameLayout
android:id="@+id/frl"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ScrollView
android:id="@+id/sv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp">
<!-- Two layouts to create bottom margin. Doesn't work otherwise -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="44dp"
android:layout_marginBottom="44dp"
tools:ignore="UselessParent">
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_regular"
android:textColor="@color/white_color"
android:textSize="18sp"
tools:text="Test" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment