I have 3 ImageViews in LinearLayout(Horizontal Orientation). I want to show them according to move touches to the left or right. First of all, I have to create 3 imageviews inside of the LinearLayout and only the one of the 3 imageviews can be visible. In TouchEvent I want to change position of the visible one,then I want to show smoothly the other one like books in iBooks. How can I do that?
Best Regards,
You can refer below example. This will be helpful to you.
here
Related
OK first I'm not actually moving buttons I'm moving imageviews that have an onclick listener. What I want to do is drag multiple imageviews around inside a layout. I was going to use a FrameLayout but it seems that wont work for multiple items.
Can anyone tell me which layout is suitable for this?
thanks in advance
Linearlayout with a vertical orientation should do it for you..use margain_direction for fine tuning it further
Maybe a GridLayout would suit your needs? You can have one or multiple child views in each grid cell.
I have a scrollview inside which I have 5 imageviews say IMV1,IMV2...IMV5 . Now on scrolling,one by one all imageviews are shown in device screen. Now I have a drawer with 5 buttons say 1,2 ..5.
Now take us a scenario,
Currently I am on first imageview. Now when I click on button 5 in the drawer.
I need IMV5 to show on the screen without scrolling.It can be obtained
through smoothScrollBy/scrollTo to y equal to 5*screenHeight. But here it
scrolls through all intermediate imageviews.
Please note,I don't wish to affect scroll feature.For above example,
After I reach IMV5,when I scroll up,it should scroll to IMV4 and so on.
Is there any way to obtain it .Please suggest.
Thanks In Advance.
P.S. If you need some more clarification,please let me know.
You can achieve this easily using a ListView instead of ScrollView.
What you can do is:-
Add all the imageviews to a ListView.
This will fulfill your scrolling requirement, as ListView automatically handles scrolling if its content's size is grater than the screen size.
Now use the listView.setSelection(position) on click of the buttons.
It will scroll to the selected imageview without giving the scrolling effect
Hope this helps.
It can be achieved through ScrollView too.. All you need to do is get the View at that position. Then call requestFocus() on the obtained view.
For example:- If you press Button 5, then IMV5.requestFocus() will do it for you
suppose i have 3 textviews set in horizontal LinearLayout which is in one screen.I know i can flip textviews with help of ViewFlipper.But is there anyway to flip portion means if i will flip then one textview will be gone and two textviews will remain.
Just see this link.
See this for ViewFlipper animation
http://android-pro.blogspot.com/2010/09/using-view-flipper-in-android.html
or you can use HorozontalPager also
link https://github.com/ysamlan/horizontalpager
Im new to Android and over the past few days I have been over many tutorials, I was wondering if you could help me with some advice.
I want images on top of each (not completely, there may be some overlapping) other with each image to be clickable.
Whats the best way to do this? Have each image in an image view? Can these be positioned on top of each other? And have onclick listeners?
Thanks for your help
Imageviews can be stacked by using the framelayout. The framelayout add each child view on top of each other based on the order of the childs ie the last child will be the top most.
Jep, ImageViews are appropriate. Add them to a RelativeLayout and add a onClickListener and you are done.
Have a close look at RelativeLayout's align* attributes.
HTH.
I have one absolute layout which contains many ImageViews. I have implemented Drog and Drop functions for all imageview. Now what happen when suppose i drag one imageview over another imageview then first view goes back side because it have been added first compaire to another one . I need that moving view always visible on top.
So can i solve this problem ?
Thanks in advance.
Probably the easiest way to avoid this is to call .bringToFront() on your ImageView when you begin your dragging code.
http://developer.android.com/reference/android/view/View.html#bringToFront%28%29