什么是等效的 java 代码<item android:left="10dp">
?
更具体地说,我试图以编程方式获得一个相当于:
<item android:left="5dp" android:bottom="5dp">
<bitmap
android:src="@drawable/screw"
android:gravity="bottom|left" />
</item>
编辑
到目前为止,我得到了:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = false;
Bitmap screw = BitmapFactory.decodeResource(res, resId, options);
BitmapDrawable s = new BitmapDrawable(res, screw);
s.setGravity(Gravity.LEFT|Gravity.BOTTOM);