您需要阅读一些开发者文档:
http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/practices/screens_support.html#screen-independence
NO:
<ImageView
android:id="@+id/icon"
android:layout_width="22px"
android:layout_height="22px"
android:layout_marginLeft="4px"
android:layout_marginRight="10px"
android:layout_marginTop="4px"
android:src="@drawable/ic_launcher" >
</ImageView>
以上也不会在屏幕
很好地扩展
是:
<ImageView
android:id="@+id/icon"
android:layout_width="22dip"
android:layout_height="22dip"
android:src="@drawable/ic_launcher" >
</ImageView>
以上将扩展其像素每设备 '独立'
或
<ImageView
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" >
</ImageView>
上面将相对它自己绘制到屏幕尺寸
或
<ImageView
android:id="@+id/icon"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="22dip"
android:src="@drawable/ic_launcher" >
</ImageView>
上面会绘制自身相对于屏幕大小和
或
ImageView imageView = new ImageView(this);
imageView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
imageView.setImageDrawable(R.drawable.background);
layout.addView(imageView);
以上就是编程
创建屏幕上的其他意见