I have ads layout under the ScrollView
. In order to prevent the ScrollView
overlapping ads layout, I have to use
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" // <--- THIS!
>
//...scrollview content
</ScrollView>
<include layout="@layout/ads_468x60"/>
What is the meaning of layout_weight
if both width and height have been set to fill_parent
?
According to documentation, this should not work, or to be precise, if both layout_height
and layout_width
have been set other than 0dp
, then layout_weight
is disregarded. But, in this example it works and bottom ads layout will not be shown without the attribute android:layout_weight="1"
inside of the ScrollView
.