Android Chat background Image morphing solution

Source: Internet
Author: User

Android Chat background image deformation, usually due to the keyboard (this is their own flirting with the Candy app in the problem, the time to solve today). You can refer to the address addressed by StackOverflow: http://stackoverflow.com/questions/5307264/ How-to-prevent-soft-keyboard-from-resizing-background-image


Here's how I use it:

The workaround is simple:

1. Activity configuration in Androidmanifest.xml file: android:windowsoftinputmode= "Adjustresize|statealwayshidden"

eg

<activity android:name= ". Mainactivity "android:label=" @string/app_name "android:windowsoftinputmode=" Adjustresize|statealwayshidden "/>

2, do not put the background image in the XML layout file, but with code implementation, in the OnCreate method add: GetWindow (). Setbackgrounddrawableresource (R.DRAWABLE.AA);

eg

Setcontentview (R.layout.activity_main);

GetWindow (). Setbackgrounddrawableresource (r.drawable.bg);

3, add android:transcriptmode= in the ListView "normal" or set to Android:transcriptmode= "Alwaysscroll" (this does not seem to modify the changes do not affect)

eg

<listview

Android:id= "@+id/lv"

Android:layout_width= "Match_parent"

android:layout_height= "0DP"

android:layout_weight= "1"

Android:divider= "@null"

Android:listselector= "@android: Color/transparent"

Android:transcriptmode= "Alwaysscroll"

/>

4, listening EditText Click event, set as follows:

EditText = (editText) Findviewbyid (R.id.edittext);

Edittext.postdelayed (New Runnable () {

public void Run () {

listview.setselection (Lists.size ()-1);

}

}, 100);


Android Chat background Image morphing solution

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.