Android¥¢¥×¥ê¤ò³«È¯¤¹¤ë¤¿¤á¤Î´ðÁäò¤Þ¤È¤á¤Æ¤¢¤ê¤Þ¤¹¡£


»öÁ°½àÈ÷

¤³¤Î±é½¬¤Ç¤Ï¡¢°Ê²¼¤Î¥×¥í¥¸¥§¥¯¥È¤ò»ÈÍѤ·¤Þ¤¹¡£
Eclipse¤Ë¥¤¥ó¥Ý¡¼¥È¤·¤Æ¤¯¤À¤µ¤¤¡£
¥×¥í¥¸¥§¥¯¥Èpractice_resource.zip

Ãͥ꥽¡¼¥¹¤ÎÄêµÁ

ʸ»úÎó

ʸ»úÎó¤òÀßÄꤹ¤ëÄêµÁ¥Õ¥¡¥¤¥ë¡Êres/values/strings.xml¡Ë¤Ë¡¢ÄêµÁ¤òµ­½Ò¤·¤Þ¤¹¡£
ÅÀÀþÆâ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
Äɵ­¤¬½ª¤ï¤Ã¤¿¤é¼Â¹Ô¤·¡¢¡ÖÃ͡פò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£Àµ¤·¤¯É½¼¨¤µ¤ì¤Þ¤·¤¿¤«¡©
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, resource practice</string>
    <string name="app_name">¥ê¥½¡¼¥¹±é½¬</string>
<!-- ¢­¤³¤³¤«¤é -->
    <string name="message1">¥á¥Ã¥»¡¼¥¸£±</string>
    <string name="message2">¥á¥Ã¥»¡¼¥¸£²</string>
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</resources>
¼¡¤Ë¡¢¥ì¥¤¥¢¥¦¥ÈXML¥Õ¥¡¥¤¥ë¡Êres/layout/values.xml¡Ë¤Ë¡¢ÄêµÁ¤òµ­½Ò¤·¤Þ¤¹¡£
ÅÀÀþÆâ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
<!-- ¢­¤³¤³¤«¤é -->
    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/message1" />
    <TextView
        android:id="@+id/textView2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/message2" />
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</LinearLayout>

¿§

¿§¤òÀßÄꤹ¤ëÄêµÁ¥Õ¥¡¥¤¥ë¡Êres/values/colors.xml¡Ë¤Ë¡¢¿§¤ÎÄêµÁ¤òµ­½Ò¤·¤Þ¤¹¡£
ÅÀÀþÆâ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
Äɵ­¤¬½ª¤ï¤Ã¤¿¤é¼Â¹Ô¤·¡¢¡ÖÃ͡פò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£Àµ¤·¤¯É½¼¨¤µ¤ì¤Þ¤·¤¿¤«¡©
res/values¤È¤¤¤¦¥Õ¥©¥ë¥À¤ò±¦¥¯¥ê¥Ã¥¯¤·¤Æ¡¢¡Ö¿·µ¬¡×->¡ÖAndroid XML¥Õ¥¡¥¤¥ë¡×¤òÁªÂò¤·¡¢colors.xml¤òºîÀ®¤·¤Æ¤¯¤À¤µ¤¤¡£
¹àÌÜÆâÍÆ
¥×¥í¥¸¥§¥¯¥Èpractice_resource
¥Õ¥¡¥¤¥ëcolors.xml
What type of resource would you like to create?ÃÍ
¥Õ¥©¥ë¥À/res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ¢­¤³¤³¤«¤é -->
    <color name="bg_gray">#909090</color>
    <color name="bg_red">#FF0000</color>
    <color name="bg_blue">#0000FF</color>
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</resources>
res/layout/values.xml¥Õ¥¡¥¤¥ë¤ò³«¤­¡¢ÅÀÀþ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
<!-- ¢­¤³¤³¤«¤é -->
  android:background="@color/bg_gray">
<!-- ¢¬¤³¤³¤Þ¤Ç -->
  <TextView 
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/message1"
<!-- ¢­¤³¤³¤«¤é -->
    android:background="@color/bg_red" />
<!-- ¢¬¤³¤³¤Þ¤Ç -->
  <TextView 
    android:id="@+id/textView2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/message2"
<!-- ¢­¤³¤³¤«¤é -->
    android:background="@color/bg_blue" />
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</LinearLayout>

Â礭¤µ

res/values¥Õ¥©¥ë¥À¤ò±¦¥¯¥ê¥Ã¥¯¤·¤Æ¡¢¡Ö¿·µ¬¡×->¡ÖAndroid XML¥Õ¥¡¥¤¥ë¡×¤òÁªÂò¤·¡¢dimens.xml¤òºîÀ®¤·¤Æ¤¯¤À¤µ¤¤¡£
¹àÌÜÆâÍÆ
¥×¥í¥¸¥§¥¯¥Èpractice_resource
¥Õ¥¡¥¤¥ëdimens.xml
What type of resource would you like to create?ÃÍ
¥Õ¥©¥ë¥À/res/values
¥Õ¥©¥ó¥È¤ÎÂ礭¤µ¤òÀßÄꤹ¤ëÄêµÁ¥Õ¥¡¥¤¥ë¡Êres/values/dimens.xml¡Ë¤òµ­½Ò¤·¤Þ¤¹¡£
ÅÀÀþÆâ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
Äɵ­¤¬½ª¤ï¤Ã¤¿¤é¼Â¹Ô¤·¡¢¡ÖÃ͡פò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£Àµ¤·¤¯É½¼¨¤µ¤ì¤Þ¤·¤¿¤«¡©
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ¢­¤³¤³¤«¤é -->
    <dimen name="font_size_20">20dip</dimen>
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</resources>
res/layout/values.xml¥Õ¥¡¥¤¥ë¤ò³«¤­¡¢ÅÀÀþ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@color/bg_white">
  <TextView 
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/message1"
    android:background="@color/bg_red" />
  <TextView 
    android:id="@+id/textView2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/message2"
<!-- ¢­¤³¤³¤«¤é -->
    android:textSize="@dimen/font_size_20"
<!-- ¢¬¤³¤³¤Þ¤Ç -->
    android:background="@color/bg_blue" />
</LinearLayout>

¤³¤³¤Þ¤Ç¤Î½¤Àµ¤Ç¡¢°Ê²¼¤ÎÍͤ˲èÌÌɽ¼¨¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢ÌäÂꤢ¤ê¤Þ¤»¤ó¡£

²èÁü¥ê¥½¡¼¥¹¤ÎÄêµÁ

res/layout¥Õ¥©¥ë¥À¤ò±¦¥¯¥ê¥Ã¥¯¤·¤Æ¡¢¡Ö¿·µ¬¡×->¡ÖAndroid XML¥Õ¥¡¥¤¥ë¡×¤òÁªÂò¤·¡¢image.xml¤òºîÀ®¤·¤Æ¤¯¤À¤µ¤¤¡£
¹àÌÜÆâÍÆ
¥×¥í¥¸¥§¥¯¥Èpractice_resource
¥Õ¥¡¥¤¥ëimage.xml
What type of resource would you like to create?¥ì¥¤¥¢¥¦¥È
¥Õ¥©¥ë¥À/res/layout
Select the root element for the XML fileLinearLayout
¥ì¥¤¥¢¥¦¥ÈÄêµÁ¥Õ¥¡¥¤¥ë¡Êres/values/image.xml¡Ë¤òµ­½Ò¤·¤Þ¤¹¡£
ÅÀÀþÆâ¤ÎÆâÍƤòÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
Äɵ­¤¬½ª¤ï¤Ã¤¿¤é¼Â¹Ô¤·¡¢¡Ö²èÁü¡×¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£Àµ¤·¤¯É½¼¨¤µ¤ì¤Þ¤·¤¿¤«¡©
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center">
<!-- ¢­¤³¤³¤«¤é -->
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/android" />
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</LinearLayout>
¼¡¤Ë¡¢ÇØ·Ê¿§¤òÊѹ¹¤·¤Þ¤¹¡£
res/values/colors.xml¡¢res/layout/image.xml¤Ë¡¢ÅÀÀþÆâ¤òÄɵ­¤·¤Æ¤¯¤À¤µ¤¤¡£
res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="bg_gral">#909090</color>
    <color name="bg_red">#FF0000</color>
    <color name="bg_blue">#0000FF</color>
<!-- ¢­¤³¤³¤«¤é -->
    <color name="bg_green">#00FF00</color>
<!-- ¢¬¤³¤³¤Þ¤Ç -->
</resources>
res/layout/image.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center"
<!-- ¢­¤³¤³¤«¤é -->
    android:background="@color/bg_green">
<!-- ¢¬¤³¤³¤Þ¤Ç -->
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/android" />
</LinearLayout>

¤³¤³¤Þ¤Ç¤Î½¤Àµ¤Ç¡¢°Ê²¼¤ÎÍͤ˲èÌÌɽ¼¨¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢ÌäÂꤢ¤ê¤Þ¤»¤ó¡£

¤³¤Î¥Ú¡¼¥¸¤Ø¤Î¥³¥á¥ó¥È

fY9vt7 Great post.Much thanks again. Really Cool.

0
Posted by check it out 2014ǯ01·î22Æü(¿å) 04:02:34 ÊÖ¿®

EJvXIf Im grateful for the blog article.Really looking forward to read more. Keep writing.

0
Posted by awesome things! 2014ǯ01·î21Æü(²Ð) 16:05:49 ÊÖ¿®

47VfrL <a href="http://rulnalzaoifr.com/">rulnalzaoifr</a>, [url=http://htuoeurhixue.com/]htuoeurhixue[/url], [link=http://kwqyxgjyribn.com/]kwqyxgjyribn[/link], http://rjkxughzwobb.com/

0
Posted by fwbybw 2013ǯ11·î21Æü(ÌÚ) 12:16:39 ÊÖ¿®

Fb0xGX <a href="http://kimqcjcxzdsa.com/">kimqcjcxzdsa</a>, [url=http://yythjbjabijd.com/]yythjbjabijd[/url], [link=http://mdmzwiupomlu.com/]mdmzwiupomlu[/link], http://caspzxsotjas.com/

0
Posted by bckdwpjlvvs 2013ǯ11·î14Æü(ÌÚ) 14:48:49 ÊÖ¿®

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

´ÉÍý¿Í/Éû´ÉÍý¿Í¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹