Skip to content

Instantly share code, notes, and snippets.

@RareScrap
Created March 23, 2017 08:57
Show Gist options
  • Save RareScrap/a3f0e4ed576dd098f02a7b55e79b4fd3 to your computer and use it in GitHub Desktop.
Save RareScrap/a3f0e4ed576dd098f02a7b55e79b4fd3 to your computer and use it in GitHub Desktop.
Пример процентной разметки с использованием weight
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:myapp="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<fragment
android:id="@+id/fragment"
android:name="android.support.v4.app.ListFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="9" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center_horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="OK"
android:id="@+id/button" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Отмена"
android:id="@+id/button2" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment