문제

I am developing an Android application and I need to put a link beside a Text Edit in a form.

The link will pop up a window that holds a tool tip for the user.

EDIT : I want to put some sort of a link beside the text field and, when the user clicks on this link, a pop up window appears and tells him how to fill this text field.

How can I do this in Android ?

Can anyone help me please ?

도움이 되었습니까?

해결책

The "link" can easyly be created by puting a TextView and adding an OnClickListener.

About the "popup":

Have you had a look at Toast-messages? They seem to be doing exactly what you want to do.

Toast toast = Toast.makeText(Context context, String yourMessage, Toast.LENGTH_LONG/SHORT);
toast.show();

If you had, here are some other solutions that could do what you want:

What about a solution with some kind of Dialog? Eg. an AltertDialog could open up, showing the tip, but the User would have to press "OK" to close the "popup".

Another solution, which is also quite ugly would be playing with visibilities. the "popup" would be present allt he time, but only visible if the link is clicked. How to change visibility of layout programaticly

다른 팁

use android:hint="Your hint" for your EditText to show hint.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top