Wednesday, 15 May 2013

android - I need to use scrollview correctly -



android - I need to use scrollview correctly -

i have 3 buttons , scroll view contains text , images. want scrollview effect images , texts , 3 buttons fixed on scrollview how can ?

use framelayout.

an illustration of top bar 3 buttons on scrollview images demonstrated below.

framelayout's render children in order declared. illustration below, scrollview rendered first, , linearlayout button bar rendered last. places bar above scrollview , gives desired effect.

the reason scrollview has linearlayout child, because can have 1 child.

<framelayout android:layout_width="match_parent" android:layout_height="match_parent"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <imageview android:layout_width="match_parent" android:layout_height="wrap_content"/> <imageview android:layout_width="match_parent" android:layout_height="wrap_content"/> <imageview android:layout_width="match_parent" android:layout_height="wrap_content"/> </linearlayout> </scrollview> <linearlayout android:layout_width="match_parent" android:layout_height="60dp" android:orientation="horizontal"> <button android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"/> <button android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"/> <button android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"/> </linearlayout> </framelayout>

android android-layout android-scrollview xml-layout

No comments:

Post a Comment