2
的性能的附加的图像是一个Gallery
图。像http://developer.android.com/resources/tutorials/views/hello-gallery.html
这里的图像是从中央位置开始。但我想从左侧开始。
我该怎么办?有没有什么财产可以做到这一点?
谢谢
的性能的附加的图像是一个Gallery
图。像http://developer.android.com/resources/tutorials/views/hello-gallery.html
这里的图像是从中央位置开始。但我想从左侧开始。
我该怎么办?有没有什么财产可以做到这一点?
谢谢
正如指出的那样,画廊视图总是从中心开始,从我们有明显的调整画廊左旁查看下面.The代码可以解释更多的左对齐图像。
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
MarginLayoutParams mymlp = (MarginLayoutParams) ga.getLayoutParams();
mymlp.setMargins(-(metrics.widthPixels/2 + 60),
mymlp.topMargin,
mymlp.rightMargin,
mymlp.bottomMargin
);
ガ - >库视图对象
60 - >此值可以相对于库中的图像的宽度来调整,在画廊我ImageView的宽度为50