Android Programming Chat page background picture, title bar due to keyboard problems caused by the solution _android

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.