Home android: ScrollView parent can't resolve the weight
Reply: 0

android: ScrollView parent can't resolve the weight

user1474
1#
user1474 Published in June 18, 2018, 3:33 am

I have a weird issue. As you can see in my code below, for hor_LnI have set the android:layout_weight to 50, therefore it should fits 50% of height of the screen to fill button's height also, however it does not.

Although if I change the ScrollView to LinearLayout as parent layout, it seems original and correct.

Here is My code:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">


    <LinearLayout
        android:id="@+id/vertical_Ln"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:weightSum="100"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/hor_Ln"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="horizontal"
            android:weightSum="10"
            android:layout_weight="50">

            <Button
                android:layout_width="0dp"
                android:layout_weight="5"
                android:layout_height="match_parent" />


        </LinearLayout>

    </LinearLayout>

</ScrollView>

Here is the output:

What is the problem ? ?

Thanks in advanced

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.353585 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO