Android programming chat page background pictures title bar due to the keyboard caused by the solution

  • 2020-10-23 20:16:44
  • OfStack

The example of this paper describes the Android programming chat page background picture, title bar due to the keyboard problems caused by the solution. To share for your reference, the details are as follows:

In one group, someone asked that the chat page was missing due to the keyboard pop-up, and the background image was distorted. Then he tried 1 time and found a solution on stackOverFlow.

The solution is simple:

1. Activity configuration in AndroidManifest. xml file:

android:windowSoftInputMode="adjustResize|stateAlwaysHidden"

2. Do not put the background image in the XML layout file. Instead, use the code.
getWindow().setBackgroundDrawableResource(R.drawable.aa);

3. Add to listview
android:transcriptMode="normal"
There will be unexpected results

4. Monitor EditText click event and set


editText.postDelayed(new Runnable() { 
  public void run() { 
   listview.setSelection(list.size() - 1); 
  } 
}, 100);

Experience more

5. Monitor EditText focus events and set hasFocus as true


editText.postDelayed(new Runnable() { 
  public void run() { 
   listview.setSelection(list.size() - 1); 
  } 
}, 100);

The experience is more.

Attach the address of StackOverFlow solution: click to view

I hope this article has been helpful for Android programming.


Related articles: