xml - Android: Two images inside a scroll view -


i able display 2 images user, images fill screen (horizontally) , able scroll down next image, possible? have been messing around different xml layouts , cant seem find solution. when place image view inside of scroll view doesn't fill screen, how can 2 in there 1 visible start off with?

 ?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@drawable/building_block"     android:layout_margin="2dp">      <scrollview         android:layout_width="match_parent"         android:layout_height="fill_parent"         android:id="@+id/scrollview"         android:layout_alignparentbottom="true"         android:layout_alignparenttop="true">          <imageview             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:adjustviewbounds="true"             android:gravity="center"             android:scaletype="fitxy"             android:src="@drawable/ic_ntm"             android:id="@+id/imageview15" />          <imageview             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:adjustviewbounds="true"             android:gravity="center"             android:scaletype="fitxy"             android:src="@drawable/ic_ntm"             android:id="@+id/imageview17"             android:layout_margintop="44dp" />      </scrollview>   </relativelayout> 

that possible. 1 image under other each filling screen , in scrollview?

you cant add more on child scrollview (or horizontalscrolview).

you can fix child layout have both elements.

<scrollview     android:layout_width="match_parent"     android:layout_height="fill_parent"     android:id="@+id/scrollview"     android:layout_alignparentbottom="true"     android:layout_alignparenttop="true">     <linearlayout          android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:orientation="vertical">     <imageview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:adjustviewbounds="true"         android:layout_weight="1"         android:gravity="center"         android:scaletype="fitxy"         android:src="@drawable/ic_ntm"         android:id="@+id/imageview15" />      <imageview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:adjustviewbounds="true"         android:gravity="center"         android:scaletype="fitxy"         android:layout_weight="1"         android:src="@drawable/ic_ntm"         android:id="@+id/imageview17"         android:layout_margintop="44dp" />      </linearlayout> </scrollview> 

also note android:layout_weight="1", each imageview can take half of view, cause if both fill_parent first show.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -