i have new's feed ListView and each item content text and images , the images has been drawled by ImageGetter() from remote server
so my question is what is the simplest way to make those images clickable ? like if user want to view picture in large mode , aim still newer for android drawable where to start ?
The View that has the image just needs a click listener attached to it. When the View with the image is clicked, handle it by either bringing up a new activity with the image as he background (larger version), bring up a Dialog with the image, or add a View from the WindowManager.
Related
I have relative layout in which i have an image view.I am selecting an image for it from the gallery.I used intent to go to other activity.When i returned to the first activity,my image from the gallery was not there.I want to display the gallery image on the screen even if i returned to the activity.please help me.
Bitmap represent any view by using pixel.I don't understand Why did you use it for textview.
You can use textview inside relative layout and set the text which is coming from intent by using ".setText()" method.
I am creating a application which contains a listView on lefthand side that display different images now i want to show that particular image in the center of the screen when user clicks on any image in listView.
You can add a custom adapter for your listview and add an onitemselectedlistener where inside it you can get the image you put in the view, and set the imageview.
You should keep the list of path of images and when user taps you will get the postion from OnItemClickListener. Using the position you can load the image from path.
The link has good content on creating custom adapters , You should use that then just map your path and positons. try that and post when you are stuck
The question might be duplicate ..sorry for that.
I have an activity (test activity) and array adapter (test array) for same.
The list contains image and text. but the image is not displayed always. It has some condition. So look is like
---------------------------------------
image1 text1
test2
test3
image4 test4
---------------------------------------
So test activity display the above list on screen.
Now i want to do different screen load on image (image activity) and text (text activity).
As the on-click handler will be in separate file (test array) i am not sure how to return to test activity and to specific task.
actually i have a list view with image and text.
Below are some scenario
Image will not be present on each row.
If image is present then Onclick of image shown other screen (for example image activity).
if user click other than image that is text show text activity screen).
What i have done is i have a list click handler in a separate file that is ArrayAdapter so i cant't do image click listener there.
So the issue was how to identify which row image is clicked?
Solution:
After lots of R&D and code changes i done below and its working:
I have added android:onClick="ImageClickHandler" for image click in xml.
and during row creation i have set row position as Id.
So when clicked on image you can get position by view.getId(), so u have the position when u click on image and hence you can get complete data on that row.
Might be there is another way....but this is what work for me.
In the native Gallery app on Android, when Select item via Option Menu action, you can select multiple items, each grid item which will have a colored-border overlay on top signify as selected when clicked.
Question:
How to do this dynamically using getView() in the ImageAdapter
class? (since there is setBackgroundColor() but not setBorder()
Is there a better way to accomplish this? (such as creating a padding
of some sort for the image within the gridview cell, then set the
background color which will look like a border)
I finally decided to use the 2nd method in the original post: creating a padding for ImageView within the gridview cell and set the background color.
I used ImageView.ScaleType.CENTER_CROP with setCropToPadding(true); for the ImageView.
While working over listView I have came across a trouble situation.
Actually I am having a image view defined in layout that is to be inflated,
And I am doing so by adapter with my own bean class XYZ.
Now what I want is I'm checking the variable pic of the bean.
If no image there ,the image view is to be hidden or gone,
When the "pic" is available it should show the list,
But the ListView getView is called everytime I scroll,,, The image appear and disappear abruptly on list scroll,
Please help me put of the situation.
I want ImageView to be displayed when it is available. And hide it when pic tag is " " (empty)
You should create a transparent image and put it in dise the drawable folder
add a condition in side the getView method
if (tag==----)
ImageView.setImageDrawable(R.Id.TransparentImage)
else
ImageView.setImageDrawable(R.Id.AvailablkeImage)
it is appear like as image is hidden in list view.
I hope this is help.