ViewPostImeInputStage ACTION_DOWN

2019-01-15 06:43发布

问题:

As I'm trying to debug my program, I can't figure out the error.

I have initialized two buttons and used .setOnClickListener on them. When the user clicks the buttons, they are supposed to see a debug message on LogCat. However, I keep seeing this message appear instead whenever I click the button, or if I click anywhere at all on the screen: ViewPostImeInputStage ACTION_DOWN.

Does anyone know what that message signifies, or if they a solution to my problem?

Thanks so much!

回答1:

ViewPostImeInputStage ACTION_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION_DOWN with every button press (and no action). The solution for this is simple, wrap your layout content with a parent. So if you xml format was

<LinearLayout <---root layout
...
<!-- your content -->
</LinearLayout> <-- root layout end

change to

<FrameLayout <---root layout
   <LinearLayout <-- parent wrap start
   ...
<!-- your content -->
   </LinearLayout> <-- parent wrap end
</FrameLayout> <-- root layout end

This solution should resolve that conflict. Atleast this is what has worked for me. Cheers!



回答2:

I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work. And then I just make some changes on my code,then it worked. I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~

button.setOnclickListener(new View.OnClickListener){
public void onClick(View v){//...
}
}

INSTEAD OF

public YourClass implements View.OnClickListener{...
public void OnClick(View v){
switch(v.getId()){
case://...
break;}}}


回答3:

I have faced the same issue which was corrected when I made the relative layout clickable(in properties).

cheers



回答4:

I had this happen to me on the first click of a CardView inside a RecyclerView. It turns out the CardView XML set:

android:focusable="true"
android:focusableInTouchMode="true"

Once I removed that, the first click (and subsequent clicks) worked fine, and I no longer had the error with ACTION_DOWN.



回答5:

I was getting ViewPostImeInputStage ACTION_DOWN message when a line of my code had -->

if(button.getText().equals("word"))

I got the desired output after correcting the if statement to -->

if(button.getText().toString().equals("word"))

Hope it helps someone.