Android will be activity beating jar package for use by third parties to resolve XML image text resources It's not sad to get into the jar wrapper problem!

Source: Internet
Author: User

The project needs to be packaged intoJardocuments for use by third parties for project requirements(the pictureThe text resource is written toJarin the package,when a third-party call,only need toAndroidmanifest.xmlconfiguration under the correspondingActivitythroughstartactivityWay Pull UpActivity): On the internet for a long time. and rely on viewAndroidsource code finally overcame the problem

A: Need clear knowledge:

1.APK Span style= "font-size:9pt" in Res folder does not pass Eclipse export jar assert can

2.Android program translated into aapt res id assert r generate in file id

xml Resource learning:

1. Assetmanager xmlresourceparseropenxmlresourceparser (String fileName) This method can speak after compiling xml file generates a resource traversal object This object enables you to get an entire layout of the view tree

2. You can set Activity in the oncrea method by setcontentview (view) the layout

Learn about picture resources:

1. Span style= "font-size:9pt" will not .9 Assert folder drawable button statelistdrawable

2.the. 9images for processingThe need to compile firstto get rid of the black stretching area up and down.mark of display areausage and non-. 9diagram Consistent

Learn about characters

1 write characters in Java in the file , written to a static Map , can be obtained by Kay_value in the global

Two: detailed operation process:

1. First set up your layout in an XML file in an ordinary way and execute it Activity Viewing interface effects

2.Delete you inXMLpicture set in the file,the properties of the font resource. becauseResfolder could not be imported intoJarpackage, unable toRgenerate the corresponding resource in the file .Id, so throughandroid:src= "@drawable/uac_logo"The picture resources set in such a way are not found. After the third party obtains the compiledxmllayouthe file throws the exception that the resource has not been photographed

2.removedbinfolder has been compiled under theAPKfile,UnzipRemove the compiledXMLfilePicture Resourcesput inAssertfolder under

3.in theActivityof theoncreatmethod is used in theXmlresourceparseropenxmlresourceparser (String fileName)Way to getLayoutfilethroughSetcontentview (view)set to the entireActivitythe layout  controls in use(Buttontextviewwait)whencan still be passedr.id.xxthe way to getat this point by parsingXMLfile, system and get to you thisXMlin each controlId(In this caseIdwhether it will be associated with third-party resourcesIdConflictThis question I think will not happen after allFindviewbyid ()the definition given is to look for theXMLof the control under theIdis there any one who's clear about this?ask? )

4. After you get to the control, you can set the text by settextsetbackground setimagedrawable , etc. background Outlook resources.

Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Android will be activity beating jar package for use by third parties to resolve XML image text resources It's not sad to get into the jar wrapper problem!

Related Article

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.