Android will make the activity into a jar package for third parties to use to completely resolve XML image text resources not sadly into the jar package problem!

Source: Internet
Author: User

The program 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,you only need toAndroidmanifest.xmlconfiguration under the correspondingActivitythroughstartactivityWay Pull UpActivity): On the internet for a long time, and rely on viewAndroidSource finally solves the problem

A: need to understand knowledge:

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

2.Android program translated into aapt res id assert r 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 allows you to get an entire layout of the view tree

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

Learn about picture resources:

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

2.the. 9images for processinglet the need to compile firstto get rid of the black stretching area up and down.mark of display areause of methods 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

Second: The specific operation process:

1. First set up your layout in an XML file and run it in a normal way Activity Viewing interface effects

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

2.removedbinalready compiled in the directoryAPKfile,UnzipRemove the compiledXMLfilePicture Resourcesput inAssertdirectory under

3.in theActivityof theoncreatmethod is used in theXmlresourceparseropenxmlresourceparser (String fileName)Way to getLayoutfilethroughSetcontentview (view)set to the entireActivitythe layout  using the controls in them(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 resourcesIdConflictI don't think this is going to happen, after all.Findviewbyid ()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 using methods such as settextsetbackground setimagedrawable background foreground resources.

Android will make the activity into a jar package for third parties to use to completely resolve XML image text resources not sadly into the jar package problem!

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.