Uživatelské nástroje

Nástroje pro tento web


navody:xml_androidl

XML Android

Příklady - resources

xml soubor s řetězci

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="name1">text</string>
    <!-- komentar -->
    <string-array name="name2">
        <item>položka1</item>
        <item>položka2</item>
    </string-array>
</resources>

styl pro text

<style name="subtitle_dialog_style" parent="@android:style/TextAppearance.Medium">
    <item name="android:textColor">#ff33b5e5</item>
    <item name="android:background">@color/attribute_table_header_background</item>
    <item name="android:padding">10dp</item>
    <item name="android:textStyle">bold</item>
</style>

syntaxe pro XML menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@[+][package:]id/resource_name"
          android:title="string"
          android:titleCondensed="string"
          android:icon="@[package:]drawable/drawable_resource_name"
          android:onClick="method name"
          android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"]
          android:actionLayout="@[package:]layout/layout_resource_name"
          android:actionViewClass="class name"
          android:actionProviderClass="class name"
          android:alphabeticShortcut="string"
          android:numericShortcut="string"
          android:checkable=["true" | "false"]
          android:visible=["true" | "false"]
          android:enabled=["true" | "false"]
          android:menuCategory=["container" | "system" | "secondary" | "alternative"]
          android:orderInCategory="integer" />
    <group android:id="@[+][package:]id/resource name"
           android:checkableBehavior=["none" | "all" | "single"]
           android:visible=["true" | "false"]
           android:enabled=["true" | "false"]
           android:menuCategory=["container" | "system" | "secondary" | "alternative"]
           android:orderInCategory="integer" >
        <item />
    </group>
    <item >
        <menu>
          <item />
        </menu>
    </item>
</menu>

Příklady - UI

pole pro editaci textu (vkládá pouze čísla)

<EditText
    android:id="@+id/editTextName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/name_form"
    android:inputType="number">

tačítko s obrázkem

<ImageButton
    android:id="@+id/button_record_point"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:contentDescription="@string/record_point"
    android:src="@drawable/button_add_point"/>
navody/xml_androidl.txt · Poslední úprava: 2013/06/01 09:14 autor: jules