Skip to content

Instantly share code, notes, and snippets.

@codeasashu
Created November 19, 2015 14:10
Show Gist options
  • Save codeasashu/728d44cb129bef72126c to your computer and use it in GitHub Desktop.
Save codeasashu/728d44cb129bef72126c to your computer and use it in GitHub Desktop.
horizontally partitioned layouts
<?xml version="1.0" encoding="utf-8"?>
<!-- You can also put all this within scrollview for better -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:baselineAligned="false"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.25">
</RelativeLayout>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="0.5">
<!-- Your main layout here -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:id="@+id/imageView"
android:src="@drawable/logo"
android:layout_centerVertical="true"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.25">
</RelativeLayout>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment