I need to show an Image on ImageView & onClick of that Image , I wanna show another image on that imageView only with some Cube-like Transition Animation as shown in the below figure with "onTouch" .
I have been searching some examples on this site which , all are intended for an activity .I need to implement it for an ImageView .
Presently I am using some ViewFlipper with two images and trying to implement it,
<ViewFlipper android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/a"
android:layout_weight="1">
<ImageView
android:contentDescription="#string/action_settings"
android:id="#+id/alphaA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/a"/>
<ImageView
android:contentDescription="#string/action_settings"
android:id="#+id/imgA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/small_aeroplane1"/>
</ViewFlipper>
..........
like that I have 4 View Flippers upto now.
I need to know , how to add cube transitions for the above case. OR is there any better way to implement CUBE TRANSITION between only two images
I think these two links will help you in your future projects.
1) https://code.google.com/p/transitionviewpager/source/browse/
2) https://github.com/jfeinstein10/JazzyViewPager
You'll have to use ViewPager,
check https://github.com/jfeinstein10/JazzyViewPager
or here is a ready ViewPager class with 3D cube animation
https://github.com/inovex/ViewPager3D/blob/master/src/de/inovex/android/widgets/ViewPager3D.java
Related
I'm trying to make AppWidget shows rotation images which can automatically change every 5 seconds,and I think ViewFlipper might be able to reach this goal.
But I get images from server and can't just put them as ImageView in .xml file under nested ViewFlipper like this:
<ViewFlipper android:id="#+id/viewflipper"
android:layout_width="match_parent"
android:layout_height="match_content"
android:autostart="true"
android:flipinterval="5000" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/drawable1"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/drawable2"/>
</ViewFlipper>
I need to add images dynamically, and shows one picture at one time. If there's more than one image, they need to be shown on AppWidget by turns.
Hope somebody could help me with this, thanks!
I assume by "dynamically" you mean there could be an arbitrary number of items. What you probably want is AdapterViewFlipper. You can follow this guide for building an AppWidget whose content is backed by an adapter.
I have an ImageView that has a picture. When the user does something, I want the picture to change to another resource.
I found this solution:
Creating animation on ImageView while changing image resource
But it first fades out the current picture and then it fades in the new one. What I want is that at the same time the first resource fades out, the new picture to fade in.
I was thinking about using 2 ImageViews, one to fade in, another to fade out. But I was wondering if it can be accomplished using a single ImageView.
(I don't want necessarily a fade-in fade-out animation... a merge/blend whatever would be ok too)
Thanks!
Finally used a ViewFlipper to switch between the two "images".
<ViewFlipper
android:id="#+id/view_flipper"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/background_level"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/background_level_1" />
<ImageView
android:id="#+id/background_level_flip1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/background_level_2" />
</ViewFlipper>
I'm developing an app which contains an image at the upper half of the screen and a gridview in the half below, like this:
<de.test.gridview.Image
android:id="#+id/image_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fadingEdgeLength="0dp"
android:scrollbars="none"
android:visibility="gone" />
<de.test.gridview.DraggableGridView
android:id="#+id/grid_view1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/topnews_container"
android:background="#FFF"
android:gravity="center"
android:numColumns="auto_fit"
android:stretchMode="none"
android:tag="grid_view_tag" >
</de.test.gridview.DraggableGridView>
The Image is set to visibility=gone and set to visible in the code manually later on.
When I now drag on of the childs of the gridview I cant be able to drag them over the image in the upper half of the screen. They are always behind the image, but never in front of it. I've tried to use
gridView.bringToFront()
and also within the gridView I tried this function. I also tried this on the children of the gridview with gridView.bringChildToFront(child). But nothing worked.
Does anybody have an idea?
I guess view with property set to View.GONE is not operational via bringToFront(). So I believe the following will work (if you are trying to bring the grid to the front/top of z):
gridView.setVisibility(View.INVISIBLE);
gridView.bringToFront();
But its looks like you want to bring imageView to the front (making gridView behind instead of front). If so you need to:
imageView.setVisibility(View.INVISIBLE);
imageView.bringToFront();
How can I make an android image slider that contains two parts. One part is an horizotal image slider (thumnail), the second part is an original image of the selected image.
This look like ios horizontal view in ios:
You need to use a Gallery and ImageView
1: Make a layout :
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="70"/>
<Gallery
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="30"/>
</LinearLayout>
2: Initialize Gallery with adapter.
3: Define onItemClickListener for gallery items where you need to change imageView given above.
Alternatively, you can use the complete code given here :
LINK (similar to what you are trying to do)
I am about finishing my first android app, and i have some questions to which i could not find an answer.
I would like to use a horizontal scroller in which to display several pictures. For that i need two things:
Paging enabled, so that the user can see the pictures one by one in the scroller.
Some kind of indicator to show me the index of the picture currently displayed.
If i manage to do the paging, i could probably display a text like 1/4 (2/4 and so on) if i had 4 pictures, but it is not very nice. I would like to have something more like the iPhone has with the gray/white dots. Is there anything like that, or would i have to implement it by adding content at runtime? (adding imageviews according to the number of the pictures and then changing images for them as the user scrolls to show progress)
Thank you.
Because I was already using ViewPager for the swiping UI, I used the excellent ViewPagerIndicator. It took about 5 minutes to integrate.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000">
<include android:id="#+id/titlebar_include" layout="#layout/titlebar"/>
<include layout="#layout/menu"/>
<android.support.v4.view.ViewPager
android:layout_width="fill_parent"
android:id="#+id/product_viewpager"
android:layout_height="0dp"
android:layout_weight="1"
/>
<com.viewpagerindicator.CirclePageIndicator
android:id="#+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
</LinearLayout>
I found the answer i was looking for: i used the Gallery widget and for the indicator dots i used ImageViews and wrote a couple of lines of code to update the selected image dot.
Here is the solution you can try: PageViews and PageIndicator by GreenDroid.
You can also have a look at sample market app: https://market.android.com/details?id=com.cyrilmottier.android.gdcatalog