我有ListView自定义行.单击任何这些行时,将重新生成ListView的数据.当发生这种情况时,我希望列表回滚到顶部.
I initially tried using setSelection(0) in each row's OnClickListener
to achieve this but was unsuccessful (I believe because the ListView
loses its scroll position when its data is invalidated - so my call to
setSelection is undone. I still don't understand how the ListView
decides where to scroll to after invalidation, though).
The only working solution I know of was given by Romain Guy here: http://groups.google.com/group/android-developers/browse_thread/thread/127ca57414035301
It involves (View.post)ing the call to _listView.setSelection(0). I …
我想我的应用程序可以在Android版本2.1和2.2上运行.在我的应用程序的一个区域,有一个肖像风格的相机 - 在两个操作系统版本上制作肖像相机预览的过程是不同的(据我所知).方法如下:
Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
camera.setParameters(parameters);
Run Code Online (Sandbox Code Playgroud)
camera.setDisplayOrientation(90);
Run Code Online (Sandbox Code Playgroud)
setDisplayOrientation(int)方法在API Level 8(2.2)中可用,因此不能在2.1上使用; 但是,使用2.1(Camera.Parameters)方法不会在2.2上正确旋转预览和图像.
这种不兼容性存在似乎很奇怪 - 是否有更正确的方法来实现这一目标,这将允许我针对这两个平台?