SoFunction
Updated on 2025-04-11

Solutions to the background picture and title bar of chat page in Android programming.

This article describes the solution to the problem caused by the keyboard in Android programming of the chat page background picture and title bar. Share it for your reference, as follows:

Someone asked in a group that the chat page popped up with the keyboard, and the custom title bar disappeared and the background picture was deformed. Then I also tossed it for a while and found a solution on *.

The solution is very simple:

1. Activity configuration in the file:

Copy the codeThe code is as follows:
android:windowSoftInputMode="adjustResize|stateAlwaysHidden"

2. Do not place the background image in the XML layout file, but implement it with code and add it to the onCreate method:
Copy the codeThe code is as follows:
getWindow().setBackgroundDrawableResource();

3. Add to listview
Copy the codeThe code is as follows:
android:transcriptMode="normal"
There will be unexpected results

4. Listen to EditText click event and set it

(new Runnable() { 
  public void run() { 
   (() - 1); 
  } 
}, 100);

More experience

5. Listen to EditText focus event and set it when hasFocus is true

(new Runnable() { 
  public void run() { 
   (() - 1); 
  } 
}, 100);

More experience.

Attach the address solved by *:Click to view

I hope this article will be helpful to everyone's Android programming design.