Make a Project with Command Line Tools If you're not utilizing the Eclipse IDE with the ADT plugin, you can rather make your venture utilizing the SDK instruments from an order line:
Change indexes into the Android SDK's apparatuses/ way. Execute: android rundown targets This prints a rundown of the accessible Android stages that you've downloaded for your SDK. Find the stage against which you need to incorporate your application. Make a note of the target id. We suggest that you choose the most astounding adaptation conceivable. You can at present form your application to help more established renditions, however setting the manufacture focus to the most recent variant permits you to upgrade your application for the most recent gadgets. In the event that you don't see any targets recorded, you have to introduce some utilizing the Android SDK Manager apparatus. See Adding Platforms and Packages. Execute: android make venture -target <target-id> -name Myfirstapp \ -way <path-to-workspace>/Myfirstapp -action Mainactivity \ -bundle com.example.myfirstapp Supplant <target-id> with an id from the rundown of focuses (from the past step) and supplant <path-to-workspace> with the area in which you need to spare your Android ventures. Your Android undertaking is presently a fundamental "Hi World" application that contains some default documents. To run the application, proceed to the following lesson. Building a Simple User Interface: The graphical client interface for an Android application is manufactured utilizing a progression of View and Viewgroup objects. Perspective articles are normally UI gadgets, for example, catches or content fields andviewgroup items are imperceptible perspective holders that characterize how the kid perspectives are laid out, for example, in a framework or a vertical rundown. Android gives a XML vocabulary that relates to the subclasses of View and Viewgroup so you can characterize your UI in XML utilizing a chain of importance of UI components. In this lesson, you'll make a design in XML that incorporates a content field and a catch. In the accompanying lesson, you'll react when the catch is pressed by sending the substance of the content field to an alternate action. Add a Text Field To make a client editable content field, include a <edittext> component inside the <linearlayout>. Like each View object, you must characterize certain XML credits to define the Edittext object's properties. Here's the way you ought to pronounce it inside the <linearlayout> component: This gives a special identifier to the perspective, which you can use to reference the item from your application code, for example, to peruse and control the article (you'll see this in the following lesson). The at sign (@) is obliged when you're alluding to any asset object from XML. It is trailed by the asset sort (id for this situation), a slice, then the asset name (edit_message). The in addition to sign (+) before the asset sort is required just when you're characterizing an asset ID surprisingly. When you incorporate the application, the SDK apparatuses utilize the ID name to make another asset ID in your venture's gen/R.java document that alludes to the Edittext component. Once the asset ID is proclaimed once thusly, different references to the ID needn't bother with the in addition to sign. Utilizing the in addition to sign is vital just when detailing another asset ID and not required for cement assets, for example, strings or formats. See the sidebox for more data about asset objects. android:layout_width and android:layout_height As opposed to utilizing particular sizes for the width and stature, the"wrap_content" worth determines that the perspective ought to be just as large as required to fit the substance of the perspective. In the event that you were to rather utilize "match_parent", then theedittext component would fill the screen, in light of the fact that it would match the measure of the guardian Linearlayout. For more data, see the Layouts guide. android:hint This is a default string to show when the content field is vacant. As opposed to utilizing a hard-coded string as the quality, the "@string/edit_message" worth alludes to a string asset characterized in a different document. Since this alludes to a cement asset (not simply an identifier), it needn't bother with the in addition to sign. Be that as it may, on the grounds that you haven't characterized the string asset yet, you'll see a compiler mistake at the outset. You'll alter this in the following area by characterizing the string. Note: This string asset has the same name as the component ID: edit_message. Notwithstanding, references to assets are constantly perused by the asset sort, (for example, id or string), so utilizing the same name does not result in impacts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2015
Categories
|