Skip to content

Instantly share code, notes, and snippets.

@zi6xuan
Created February 20, 2018 07:45
Show Gist options
  • Save zi6xuan/bce67a2cd0d345cfdcc97f1e4154b6d9 to your computer and use it in GitHub Desktop.
Save zi6xuan/bce67a2cd0d345cfdcc97f1e4154b6d9 to your computer and use it in GitHub Desktop.
android:layout_weight="1"实现自动填充剩余空间
<LinearLayout 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:orientation="vertical"
tools:context="com.nttd.app.test.CarMessage.fragments.NormalFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="@drawable/background_border">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp" />
</ScrollView>
<Button
android:id="@+id/btnLogout"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="Logout" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment