scrollview

How to scale small imageview to fill large scrollview?

走远了吗. 提交于 2020-01-17 04:04:05
问题 How do you create a layout with a screen-filling scrollview that has a small image in an imageview scaled to fit the whole scrollview and be scrollable? eg. A 720x1280 display has a full-screen scrollview (fill_parent). Inside is a linearlayout (fill_parent). In that is a 300x900 bitmap in an imageview that is upscaled to 720x2160, fills the screen width and exceeds the vertical bounds, and can be scrolled up/down in the scrollview. The solution should work for all screen sizes to support

How to scale small imageview to fill large scrollview?

て烟熏妆下的殇ゞ 提交于 2020-01-17 04:04:00
问题 How do you create a layout with a screen-filling scrollview that has a small image in an imageview scaled to fit the whole scrollview and be scrollable? eg. A 720x1280 display has a full-screen scrollview (fill_parent). Inside is a linearlayout (fill_parent). In that is a 300x900 bitmap in an imageview that is upscaled to 720x2160, fills the screen width and exceeds the vertical bounds, and can be scrolled up/down in the scrollview. The solution should work for all screen sizes to support

图片轮播问题

╄→尐↘猪︶ㄣ 提交于 2020-01-17 01:26:42
1. 图片轮播效果实现 主要实现思路是:根据图片总数及宽高设置好ScrollView的大小,每切换一张图片相当于在ScrollView上进行一个图片宽度的移动行为,并加入定时器,实现自动轮播。 如图所示,设置好ScrollView及PageControl,ScrollView的contentSize根据图片数量确定,注意启用pagingEnabled这个属性,确保整页移动,同样pageControl也是根据图片数量来确定,每一页代表一张图片。 contentOffset更新页码。 定时器设置,这里设置为每隔2秒滚动更新一次,实际上就是每隔2秒更新一次页码,根据页码的变化,让ScrollView跟着移动,每次移动一张图片的距离 这里还需要注意的是,由于加入定时器有自动轮播的效果了,会与手动拖拽ScrollView冲突,即手动拖拽ScrollView过程时ScrollView可能自动移动更新图片了,显然这种效果是不符合用户习惯的,这时需要在ScrollView的代理事件中进行处理,即开始拖拽ScrollView时停止定时器,拖拽结束后再开启定时器。 这里有两个问题: (1)首先是移动到最后一张图片时无法移动了,如果是制作APP的新特性页面,这样的滚动效果已经可以了,但如果在广告位或者是滚动新闻这些场景下这种效果是不够好的,一般滚动到最后一张图片时,继续拖拽都会移动到第一张图片

iOS开发——高级篇——图片轮播及其无限循环效果

前提是你 提交于 2020-01-17 01:26:30
平时APP中的广告位、或者滚动的新闻图片等用到的就是图片轮播这种效果,实现方式主要有两种,一种是ScrollView+ImageView,另一种则是通过CollectionView,今天总结的是ScrollView这种方式。 1.图片轮播效果实现 主要实现思路是:根据图片总数及宽高设置好ScrollView的大小,每切换一张图片相当于在ScrollView上进行一个图片宽度的移动行为,并加入定时器,实现自动轮播。 如图所示,设置好ScrollView及PageControl,ScrollView的contentSize根据图片数量确定,注意启用pagingEnabled这个属性,确保整页移动,同样pageControl也是根据图片数量来确定,每一页代表一张图片。 图片命名采用数字序号方式,方便使用,需要注意的是,pageControl是由0开始的,也就是0对应image1,1对应image2...依次类推 加载图片并将准备好的图片在ScrollView里设置好位置,即将这些图片一张紧挨着一张排列在ScrollView中。 通过ScrollView的代理方法,在ScrollView滚动结束的时候根据 contentOffset更新页码。 定时器设置,这里设置为每隔2秒滚动更新一次,实际上就是每隔2秒更新一次页码,根据页码的变化,让ScrollView跟着移动,每次移动一张图片的距离

implement Globe-Weis File Folder in android

前提是你 提交于 2020-01-16 01:19:29
问题 i want to implement Globe-Weis File Folder like picture below which by clicking on green button it scrolling smoothly up and by clicking on the green button again ,the folder page scrolling down smoothly. what i try so far was putting three scrollView in a frameLayout , and to open and close it if (!underIsOpen) { ObjectAnimator .ofInt(sv_Under, "scrollY", findViewById(R.id.ll_under_botton).getTop()) .setDuration(1000).start(); underIsOpen = true; } else { ObjectAnimator .ofInt(sv_Under,

Tablelayout in Scrollview not working

微笑、不失礼 提交于 2020-01-15 11:59:27
问题 My fragment loads its data into a tablelayout inside a scrollview. At first, it will load saying "Click on image to view more data". I have a onclick listener from the gallery that should delete all the rows from the tablelayout with tableLayout.removeAllViews(); . Then the fragment will add row/rows to a tablelayout inside a scrollview. The tablelayout should change on every click from the gallery. However I am getting: **java.lang.IllegalStateException: ScrollView can host only one direct

How to Zoom a Text View in Scroll View?

↘锁芯ラ 提交于 2020-01-15 09:02:19
问题 I have seen a lots of code here which is helpful to zoom your textview but none of them work with my text because it is within scrollview . How can I get rid of this problem? import android.app.Activity; import android.os.Bundle; import android.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.TextView; public class Introduce extends Activity implements OnTouchListener{ final static float STEP = 200; TextView mtxtRatio1,mtxtRatio2

How to detect when a view inside HorizontalScrollView touches another view?

旧巷老猫 提交于 2020-01-15 08:42:30
问题 So I'm trying to create iMovie like scroll view, I want to get a callback when the image inside the scroll view touch the white line (so I could change the large image). How can I do that? 回答1: This solution works for me and also this is the only solution I was able to make out after a long research on options we have with HorizontalScrollView. ImageView lineImage=(ImageView)findViewById(R.id.yourImageViewIdOfWhiteLineImage); Then in onTouchListener of your horizontalScrollView public boolean

Input Text Field hidden below keyboard in Android webview

此生再无相见时 提交于 2020-01-14 12:41:26
问题 I implement Webview in my app in Fragment but in Webview EditText Field Hide when the keyboard appears. I Set WindowSoftInputMode = SoftInput.StateHidden | SoftInput.AdjustResize and android:fitsSystemWindows="true" but not working for me. I also use custom RelativeLayout but it's not working. Please help me to solve this issue. My Code is below in Fragment <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout

Input Text Field hidden below keyboard in Android webview

我与影子孤独终老i 提交于 2020-01-14 12:41:22
问题 I implement Webview in my app in Fragment but in Webview EditText Field Hide when the keyboard appears. I Set WindowSoftInputMode = SoftInput.StateHidden | SoftInput.AdjustResize and android:fitsSystemWindows="true" but not working for me. I also use custom RelativeLayout but it's not working. Please help me to solve this issue. My Code is below in Fragment <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout