本文实例讲述了Android中资源文件用法。分享给大家供大家参考,具体如下:
一、XML文件间资源文件的使用
引用格式:
attribute=\"@[packagename:]resourcetype/resourceidentifier\"
example:
有strings.xml、color.xml、dimen.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:padding=\"@dimen/standard_border\"> <EditText android:id=\"@+id/myEditText\" android:layout_width=\"fill_parent\" android:layout_height=\"wrap_content\" android:text=\"@string/stop_message\" android:textColor=\"@color/opaque_blue\" /> </LinearLayout>
二、使用系统的资源
使用android本地系统资源要这样写:
希望本文所述对大家Android程序设计有所帮助。
本文地址:https://www.stayed.cn/item/10524
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我