Display a scrollable image from a url in android studio -
i'm trying create activity display image obtained url. want width of image adapt screen height of image can longer screen image becomes scrollable (vertically). first of all, displayed image drawable folder , worked following code :
<scrollview android:layout_width="fill_parent" android:id="@+id/scrollview1" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:scrollbaralwaysdrawverticaltrack="true"> <linearlayout android:id="@+id/linearlayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal"> <imageview android:src="@drawable/programme" android:layout_height="wrap_content" android:id="@+id/imageview2" android:layout_width="wrap_content" android:scaletype="fitstart"></imageview> </linearlayout> </scrollview>
i obtained wanted : http://i.stack.imgur.com/impkz.png
but wanted image charge url used ion library :
ion.with(imageview) .load("http://...");
the image load no longer scrollable , doesn't display wanted. http://i.gyazo.com/704324724364235bbe417d5447265c42.png
do have solution? thanks
i found solution setting android:layout_width="match_parent" in scrollview, imageview , linearlayout , setting android:adjustviewbounds="true" imageview :
<scrollview android:layout_width="match_parent" android:id="@+id/scrollview1" android:layout_height="wrap_content" android:scrollbaralwaysdrawverticaltrack="true"> <linearlayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <imageview android:id="@+id/imageview2" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaletype="fitstart" android:adjustviewbounds="true"/> </linearlayout> </scrollview>
Comments
Post a Comment