Percentagelayout is deprecated in Android, but you can achieve the same results with LinearLayout:
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:weightSum="100" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="40" android:orientation="vertical"> <Button android:id="@+id/btnPlayer2" android:layout_width="match_parent" android:layout_height="match_parent" android:text="Button" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="20" android:orientation="vertical"> <Button android:id="@+id/btnStart" android:layout_width="match_parent" android:layout_height="match_parent" android:text="Button" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="40" android:orientation="vertical"> <Button android:id="@+id/btnPlayer1" android:layout_width="match_parent" android:layout_height="match_parent" android:text="Button" /> </LinearLayout> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
No comments:
Post a Comment