i'm having problems scrollview
, imageview
.
what want is:
i have imageview
set @ top of screen. then, have scrollview
go elements of view
, , inside have imageview
set @ bottom of screen when previous elements don't fill screen (usually big screens), , set @ bottom of scrollview
when exists scroll.
it ok other activities
have, have problems in 1 activity
has framelayout
.
what is:
(see code below) when set in relativelayout
of imageview
(the 1 stay @ bottom) height = "wrap_content"
:
- in portrait orientation:
image
don't have real size because doesn't fit on screen. fit in it,scroll
should appear. -> don't know why doesn't appear in otheractivities
. - in landscape orientation:
imageview
appears @ bottom of screen. other elements don't fit on screen,scroll
appears insideframelayout
.
when set in relativelayout
of imageview
(the 1 stay @ bottom) height = "200dp"
(real height of image smaller):
- in portrait orientation:
image
doesn't appear. there isn'tscroll
(it not necessary because other elements seen). - in landscape orientation: appear 2
scrolls
. 1 insideframelayout
elements, , seeingimageview
.
here code date:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="fill_parent" tools:context=".facturasactivity" android:orientation="vertical" > <linearlayout android:id="@+id/linearlayoutlogofactor_factura" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <imageview android:id="@+id/imageviewlogofactor_factura" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo_factorenergia"/> </linearlayout> <scrollview android:id="@+id/scrollviewmain" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true" > <linearlayout android:id="@+id/linearlayoutmain2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginleft="20dp" android:layout_marginright="20dp" android:layout_gravity="center_horizontal" android:focusable="true" android:focusableintouchmode="true" android:orientation="vertical" > <linearlayout android:id="@+id/linearlayoutdireccionfactura" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="25dp" android:layout_marginright="25dp" android:layout_margintop="10dp" android:weightsum="1.0"> <textview android:id="@+id/textviewlabeldireccionfactura" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.3" android:text="@string/etiqueta_direccion" android:textsize="@dimen/textsize" android:textstyle="bold" /> <textview android:id="@+id/textviewdireccion" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.7" android:textsize="@dimen/textsize" /> </linearlayout> <framelayout android:id="@+id/framelayoutfacturas" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="25dp" android:layout_marginright="25dp" android:layout_margintop="10dp" > <listview android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <textview android:id="@android:id/empty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/facturas_vacia" android:textsize="@dimen/textsize" /> </framelayout> <relativelayout android:id="@+id/linearlayoutimageninferior_main" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="20dp" > <imageview android:id="@+id/imageviewimageninferior_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:adjustviewbounds="true" android:src="@drawable/la_electrica_de_las_empresas" /> </relativelayout> </linearlayout> </scrollview> </linearlayout>
can me? in advance.
the solution i've found, looking @ that question, is:
create function:
public static void setlistviewheightbasedonchildren(listview listview) { listadapter listadapter = listview.getadapter(); if (listadapter == null) { // pre-condition return; } int totalheight = 0; (int = 0; < listadapter.getcount(); i++) { view listitem = listadapter.getview(i, null, listview); listitem.measure(0, 0); totalheight += listitem.getmeasuredheight(); } viewgroup.layoutparams params = listview.getlayoutparams(); params.height = totalheight + (listview.getdividerheight() * (listadapter.getcount() - 1)); listview.setlayoutparams(params); }
and call listview. 1 scroll
(the 1 of scrollview
) seen , used.
Comments
Post a Comment