android的适配方法
转载
说明一下这个图的意思,就是我要说的配置方法,就是一套图片资源(资源文件要看美工的设计了。最好能是XXX.9.png)配一套布局文件及多套数值文件。
布局文件:
[html]
view plain
copy
print
?
1. <?xml version="1.0" encoding="utf-8"?>
2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3. android:layout_width="fill_parent"
4. android:layout_height="fill_parent"
5. android:orientation="vertical" >
6.
7. <ImageView
8. android:layout_width="@dimen/imagewidth"
9. android:layout_height="wrap_content"
10. android:background="@drawable/ic_launcher" />
11.
12. </LinearLayout>
数值文件:
[html]
view plain
copy
print
?
1. <?xml version="1.0" encoding="utf-8"?>
2. <resources>
3. <!-- values-hdpi 480X800 -->
4. <dimen name="imagewidth">320dip</dimen>
5. </resources>
[html]
view plain
copy
print
?
1. <resources>
2. <!-- values-hdpi-1280x800 -->
3. <dimen name="imagewidth">320dip</dimen>
4. </resources>
[html]
view plain
copy
print
?
1. <?xml version="1.0" encoding="utf-8"?>
2. <resources>
3. <!-- values-hdpi 480X320 -->
4. <dimen name="imagewidth">320dip</dimen>
5. </resources>