embed the string in view flipper ontouch - android

I am creating an application in which i have used four custom view.I have embed that in the viewflipper now i want to add ontouch event to viewflipper.i have added the ontouchevent but i want that when user touch on the particular position then it will show some text on the canvas which is used by viewflipper.
I have uploaded the image also can any one help me on this topic .

Use a text View in your ViewFlipper and set its visibility to View.Gone orView.Invisible
when click on your particular zone call
myTextView.setText("your text");
myTextView.setVisibility(View.Visible);
hope that idea will help you

I have mention in my question that i am using view.so i have used the invalidate method .
Viewflipper .invalidate ();
invalidate method force to redraw the view if you want more knowledge then refer this link

Related

Is it possible to change ImageView ID dynamically?

I am facing a problem with my 2 listeners that listen to the same ImageView ID. Thinking to only enable 1 of them during menu click, and hide the other 1.
Unless your View is part of a custom View hierarchy then you shouldn't do it because of possible conflict. I think what you really want to do is not to have two listeners but change the content of a same listener based on a click. Why not simply use if ?
Of course you can. You can call View.setId(int) and View.getId() to set and get a View's id. But change ImageView ID dynamically is not recommended at all. Because conflicts of different views are easy to happen if you do so.

How to make a Custom view & repeat for multiple time in android?

I want to make a customs layout.
In that it contain one Text View and one share button at the bottom
like this
I want to repeat this view for a multiple time like this
it should dynamically add view when new entrees is added to the db.
So can any one help me to solve this problem
Thank's in advance.
Use a grid view. That will help solve your requirement.

Listview zoom and animation in Android

Hello Please help me with an Issue, I have a gallery to which i had applied animation. What is actually does it zoom the current/clicked view.
I want that same behaviour in my listview, for example i have
PLAY
SETTINGS
QUIT
So when i click PLAY it should have a zoom effect PLAY
Please guide me..
The view that you are trying to implement can be done with gallaryview in android. So if you can modify gallery then you can get this behaviour, if it seems tough that just grab the opensource coverflow code and modify it a bit to get desired behaviour
you can have an integer variable to hold, currently focused element in list, and in your adapter's getView method, check this variable with position and on match can return a different view, on focus change, reset position holder value, and call adapter.notifyDataSetInvalidated();

How to replace the entire layout with a webview

I have a Edittext, a button and a ListView in my activity. Now when any of the options on listview are selected i want to replace everything by a webview and if the user presses back i want to come back to the original view.
How do i do this?
I looked at View flipper but that is mostly used if you switch between views a lot, also is it a good idea to use webview with viewflipper.
You could use the visiblity of the views, so setup a webview that fills the screen then set its visibility to gone in your xml, then when you want to display it use myView.setVisibility(View.VISIBLE); in your code to display the webview, it would probable be a good idead to make your buttons etc invisible using myView.setVisibility(View.GONE);
It would however be easier just to setup another activity with your webview in and just start that activity when required.
In view method of item Listener of your code do something like this...
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("Web link here"));
and you are done with it...
Or please post your code so I can help you in better manner...

Actions on gallery view android

i have two gallery views in my single UI screen or you may say activity, i want to have listener in such a way that on scroll of one gallery view the other should also scroll , i tried giving listener to one gallery and calling the other one gallery view into that ., but its working for me , pls can any one help me..
thanks in advance
Datta
You could try to find the position of one of the galleries with Gallery.setOnItemSelectedListener() and then update the other gallery with Gallery.setSelection().
I believe the Gallery view is missing a lot of functionality (or is broken) as compared to ListView or GridView. In this particular instance, you need a "setOnCenteredItemChangedListener" or something like that. However, the documentation does not show anything close to this.
One option would be to implement your own Gallery class using HorizontalScrollView.
Another (hacky) option would be to rely on your Gallery adapter to push the current position being fetched (which may NOT be the one displayed in the middle) and use that to guess the currently selected position.
You have to override the scroll event of your first gallery and inside this method you should call the onScroll event of your second gallery like this,
gallery_two.onScroll(MotionEvent e1,MotionEvent e2,x,y);

Categories

Resources