This article illustrates the solution to the problem of the chat page background picture and title bar caused by the keyboard in Android programming. Share to everyone for your reference, specific as follows:
In a group of people asked the chat page because the keyboard bounce out, causing the custom title bar is not visible and the background image are distorted, and then they also toss a bit, in the stackoverflow above found a solution.
The solution is simple:
1, the activity in the Androidmanifest.xml file configuration:
Copy Code code as follows:
Android:windowsoftinputmode= "Adjustresize|statealwayshidden"
2, do not put the background picture in the XML layout file, but in code implementation, in the OnCreate method plus:
Copy Code code as follows:
GetWindow (). Setbackgrounddrawableresource (R.DRAWABLE.AA);
3. Add in the ListView
Copy Code code as follows:
Android:transcriptmode= "Normal"
There will be unexpected results.
4, monitor EditText Click event, set
Edittext.postdelayed (New Runnable () {public
void run () {
listview.setselection (list.size ()-1);
}
} , 100);
Experience more
5, monitor EditText focus events, set when Hasfocus is True
Edittext.postdelayed (New Runnable () {public
void run () {
listview.setselection (list.size ()-1);
}
} , 100);
Experience more.
Attached StackOverflow Address: Click to view
I hope this article will help you with the Android program.