i'm trying to make that all the content i have in a view can be scroll-able and what i'm doing is adding a Scrollview to the entire relative layout but when i do this anything is shown in the view. Below is the layout code i have with the Scrollview.
<Scrollview
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="3dip">
<ImageView
android:id="@+id/peliculaPortada"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginRight="6dip" />
<TextView
android:id="@+id/detPeliculaTitulo"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/peliculaPortada"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignTop="@id/peliculaPortada"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:textSize="9pt" />
<TextView
android:id="@+id/detPeliculaRestriccion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/peliculaPortada"
android:layout_alignParentRight="true"
android:layout_alignParentTop="false"
android:text="Restricción: "
android:layout_below="@id/detPeliculaTitulo"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:textSize="6pt" />
<TextView
android:id="@+id/detPeliculaGenero"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/peliculaPortada"
android:layout_alignParentRight="true"
android:layout_alignParentTop="false"
android:text="Genero: "
android:layout_below="@+id/detPeliculaRestriccion"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:textSize="6pt" />
<TextView
android:id="@+id/detPeliculaDuracion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/peliculaPortada"
android:layout_alignParentRight="true"
android:layout_alignParentTop="false"
android:text="Duración: "
android:layout_below="@+id/detPeliculaGenero"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:textSize="6pt" />
<TextView
android:id="@+id/detPeliculaFechaEstreno"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/peliculaPortada"
android:layout_alignParentRight="true"
android:layout_alignParentTop="false"
android:text="Fecha Estreno: "
android:layout_below="@+id/detPeliculaDuracion"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:textSize="6pt" />
<Button
android:id="@+id/sitioOficial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/button_sitio_oficial"
android:layout_below="@+id/peliculaPortada"
android:text="Sitio Oficial"
android:layout_alignLeft="@id/peliculaPortada"
android:gravity="left|center_vertical"
android:layout_alignParentRight="true"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:layout_toLeftOf="@id/peliculaPortada"
android:paddingTop="0pt" />
<Button
android:id="@+id/imdb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/button_link"
android:layout_below="@+id/sitioOficial"
android:text="Imdb"
android:layout_alignLeft="@id/peliculaPortada"
android:gravity="left|center_vertical"
android:layout_alignParentRight="true"
android:layout_marginLeft="4开发者_JAVA技巧dip"
android:layout_marginRight="4dip"
android:layout_toLeftOf="@id/peliculaPortada" />
<Button
android:id="@+id/trailer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/button_trailer"
android:layout_below="@id/imdb"
android:text="Trailer"
android:layout_alignLeft="@id/peliculaPortada"
android:gravity="left|center_vertical"
android:layout_alignParentRight="true"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:layout_toLeftOf="@id/peliculaPortada"
android:paddingTop="0pt" />
<Button
android:id="@+id/sinopsis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/button_sinopsis"
android:layout_below="@id/trailer"
android:text="Sinopsis"
android:layout_alignLeft="@id/peliculaPortada"
android:gravity="left|center_vertical"
android:layout_alignParentRight="true"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:layout_toLeftOf="@id/peliculaPortada"
android:paddingTop="0pt" />
<TextView
android:id="@+id/detPeliculaPresentandose"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="true"
android:layout_below="@id/sinopsis"
android:layout_toLeftOf="@id/peliculaPortada"
android:singleLine="false"
android:ellipsize="none"
android:scrollHorizontally="false"
android:layout_weight="1"
android:text="Presentandose En"
android:paddingTop="2pt"
android:textSize="7pt" />
<ListView
android:id="@+id/detPeliculaTandas"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/detPeliculaPresentandose"
android:paddingTop="3pt">
</ListView>
</RelativeLayout>
Thanks in advance for any help.
i found a solution through the use of an unusual method that was provided by doughw. The solution is to hack the listview to load to a full height.
Here is the link to the answer: How can I put a ListView into a ScrollView without it collapsing?
Thanks everybody.
I had an issue close to what you had and my problem was using layout_width="match_parent" on items that were aligned to the left or right of another item. I changed it to layout_width="wrap_content" and everything worked perfectly after that.
Change the wrap_content
to fill_parent
in the scrollview height attribute.
精彩评论