android:layout_weight beginner's question
and
Understanding weight and layout_weight, the bigger layout_weight is, more it shrinks in the layout.
both these links post a similar question, but those solutions have not helped me.
The xml code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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="com.example.pranavhd.assign1.MainActivity">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:orientation="horizontal"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:orientation="horizontal"></LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
So if I put total weight as 10, and divide it in 7:3 ratio, I get this uneven layout. As it can be seen, the one with weight as 7, looks smaller than the one with 3. I also tried setting layout_height = 0px or layout_width = 0px. In this case, the layout was shrinked to 0.Where weight ratio are 7:3