I wanna create android animation like shown on this example. Only one change I need here. I wanna create two button (Previous and Next). I want see next image for clicking next button, and previous- previous button.
Is there a way to this or there is another examples? Thanks
In buttons OnClickListener increment the position of the image that u want to show
imageView.setImageResource(position);
More
UPDATE
imgView.setImageResource(Imgid[position]);
you can get teh current position of the image using the methods available in example u gave.
Related
I have three activities and in my first activity i have 2 imageviews , by clicking each image it is navigating to the next activities. All the three activities contains imageviews. Now my problem is when navigating to the next activity on click, default image is getting highlighted, instead i would like to highlight a specific image of my choice.Help me in achieving this.
Try setting setColorFilter to your view. You can highlight the your specific view.
PorterDuffColorFilter setNewFilter =
new PorterDuffColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP);
ImageView imgSelected = (ImageView)findViewById(R.id.myImage);
Drawable d = imgSelected.getBackground();
d.setColorFilter(setNewFilter)
// Remove the filter by setting it as null.
d.setColorFilter(null);
Finally i found the ans.. It is very simple we need to set request focus on the particular image
img1.requestFocus();
near particular onclick. Hope this may help someone :-)
I wanted to add a listview in an image button in such a way that when i clicked the button the information which is present in the listview should display in the next page. Could anyone help me with this??
see this is how it should be if i click on any of these buttons it has to list the information and that to be displayed in the next activity not in the same
You cannot add view to another view. You can to viewGroup, but not to view. So i would suggest you to take a screenshot of your listview (which you will have to create it first, or you should figure something else out) and then set that image into imageButton.
you can use tabhost to create tabs with the images. Plz take a look at the following tutorials:
Tutorial 1
Tutorial 2
Tutorial 3
Inside each tab you can place the custom list view.
I've got a questions. I have an OnClick method. So user clicks on button it randomly gens image. So when he finds the similar image and clicks on it I need to do OnClick from the beginning.
No, there is a point:
1.User click on 1 image
2. It generates the second image
3. 3 different images is already on the desk and he needs to find the proper image.
Ok,
If a = b, then do the onClick method for image 1.
Assuming you want the user to click on image to generate new image, then you can use ImageButton for this. Add OnClickListener to this button and change the image in that listener.
Tutorial here
So I have been scratching my head and trying to figure out how to do it.
TO give some more info:
I have a gridview with a bunch of pictures taken from a database. When someone clicks a picture, a new activity starts and there is an imageview that shows that same picture that was clicked. The above I have already coded except for the button that can change the imageview.
Now I would like to implement a button that basically shows the next picture from the database (or the next picture to the right from the gridview).
I am looking for a button that when pressed, will switch the imageview to display a different image from my database.
I have tried to use imageswitcher, viewswitcher, and some other things but to no avail.
I have a function called "GetPic" that takes the path of the pic (from drawable) clicked so it can show it in the imageview in the new activity.
if any other info is needed, i'll gladly share it.
thanks!
EDIT: getpic is my function that grabs the drawble path from the database. If I put (GetPic(activity_here.pos)) activity_here.pos will give GetPic the position from the gridview (which picture was selected) and then GetPic spits out the path the the picture selected so it can be shown in the imageview
if I do (GetPic(activity_here.pos+1)) this will show the next picture (which is what I want) just if I make the button simply add one to the position, I have to turn my imageview in to "final" so I can only get the next picture once(i don't want), not until I have run out of pictures to show(i want).
Check this : Android: ImageSwitcher
Also this would help you as well: https://www.youtube.com/watch?v=Jc11oWIjz-w
& don't forget the third part. Good luck .
This is my first project in android and I want to display something like this in list view
Any advice is appreciated
You can go through CustomListView example.it can be done easily.
Please go through the Link below
how to customize listview row android
For achieving this layout you should use custom listview for that like it.
A row with one text view and four button mean five object in each row but show only two object one is textview and another is one button out or four button.
If you want to display fourth button then invisible first there button and fourth button in visible state.
If you want to display second button then first, third and fourth button invisible state only second button in visible state.
Fallow this logic in each row.
I hope you got you answer after using this logic.