小编aak*_*ash的帖子

Android ListView滚动到顶部

我有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 listview

80
推荐指数
5
解决办法
7万
查看次数

Android API版本兼容性

我想我的应用程序可以在Android版本2.1和2.2上运行.在我的应用程序的一个区域,有一个肖像风格的相机 - 在两个操作系统版本上制作肖像相机预览的过程是不同的(据我所知).方法如下:

2.1:

Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
camera.setParameters(parameters);
Run Code Online (Sandbox Code Playgroud)

2.2:

camera.setDisplayOrientation(90);
Run Code Online (Sandbox Code Playgroud)

setDisplayOrientation(int)方法在API Level 8(2.2)中可用,因此不能在2.1上使用; 但是,使用2.1(Camera.Parameters)方法不会在2.2上正确旋转预览和图像.

这种不兼容性存在似乎很奇怪 - 是否有更正确的方法来实现这一目标,这将允许我针对这两个平台?

compatibility camera android rotation

8
推荐指数
2
解决办法
3619
查看次数

标签 统计

android ×2

camera ×1

compatibility ×1

listview ×1

rotation ×1