Textview animation works only once on Android Studio - java

There is a button and when it is clicked on I want a message to slide to right and then fade away. It works only the first time this certain layout is loaded. This is what I've written
popTextView.animate().translationX(popTextView.getWidth()).alpha(0.0f).setDuration(1500);

Set repeat rount for your animation.
animation.setRepeatCount(Animation.INFINITE);
or
animation.setRepeatCount(5);

try calling YourView.getAnimation().start(); while clicking on button

Related

How can I set on the screen, the 'onClick' method 'setSoundEffectEnabled(false)'?

My ConstraintLayout has an OnClick method, so every time the screen is touched, i works like a button. But the problem here is that I need to get rid of the default sound button but the setSoundEffectEnabled(false)' ONLY works for actual button views.
Any ideas?

Unable to see button in MainActivity when coming back from another activity

I have a MainActivity where I am showing a button at the bottom of the screen and there some other buttons in the middle of the screen.
At this point of time the bottom button is not doing any thing.
Clicking on any other buttons opens another activity - DisplayActivity.
My issue is that when I am coming back to MainActivity from DisplayActivity, the bottom button is not getting displayed.
I have to kill the app and launch it again in order to see it.
Please let me know if you are aware of this issue and have any solution.
Many Thanks.
I'd say you don't instantiate your layout XML in your onCreate method, but somewhere else

Android Studio. Clickable Progress Bar

I have created a progress bar in Android Studio that goes from 100 to 0 with a step 10 and sleep(500).Each step is displayed.
Now what I want to do is to make the step occur whenever I click on the bar.
How do I do this?
I wouldn't like to create a button on the backgroud of the progress bar, I would like to be able to click on it and make it wait for my next click.
Thank you!
I think you can set
android:clickable(true)
android:onClick(something())
when you set onClick, you dont need to set a ClickListener

how to disappear button in android

I am working on an interface where user searches for a specific item from database. I have one EditText and button in my xml file. So i want to disappear the botton and EditText temporarily , after clicking the buuton , so that user can view the required details..
How can I implement this within same activity?
edittxt.setVisibility (View.INVISIBLE);
btn.setVisibility (View.INVISIBLE);
or
edittxt.setVisibility (View.GONE);
btn.setVisibility (View.GONE);
View.INVISIBLE means, the views will still take space on screen. Whereas, View.GONE means they will not take space on the screen. More info if you want.
Try this
button.setVisibility(View.GONE);
when you want to visible than
button.setVisibility(View.VISIBLE);
Disappear means invisible,
edittext.setVisibility(View.INVISIBLE);
you can visible the editext,
edittext.setVisibility(View.VISIBLE);

Can I show up the textbox editor on an image icon in Android?

all,
We know on Andorid, for a EditText, by default, whenever the EditText is clicked, the soft keyboard pops up to let you enter text. When you click DONE, it closes out and put the text directly to the EditText.
Now, what I am trying to do is, instead of an EditText, I have an ImageView which is to let user enter some comment.(So the ImageView actually is an comment icon). I wish whenever the icon is clicked, it pops up the text editor with user previous entered text, again once the DONE is hit, it closes out and I can save whatever text there back to a string member of the Activity. Is that possible?
So far, all I've seen about InputMethodManager is on EditText control, If it is too complicated, I probably just put an EditText into a sperate Activity.
Thanks.
There are many solutions:
One is to use custom dialog: http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
Second one is to use a transparent activity on top of that one.
Then you could use FrameLayout and insert another view in an exact position...
I think you should try the frist or second one. Every ImageView can be easily converted into a button by adding onClick event to it.

Categories

Resources