我在ScrollView中有一个ListView,我可以通过我的HTC Wildfire上的光学鼠标按钮滚动列表的内容 - 这就像物理光标上/下的东西。到现在为止还挺好。坏消息是,我无法通过正常的触摸/滑动功能来滚动列表,这通常适用于这种列表。ListViewn不能通过滑动滚动
什么可能是错的?
我的布局是这样的:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView android:id="@+id/MessageList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</ScrollView>
而且一些Java代码来初始化列表:
public class MorseIt extends Activity {
private ListView lv1;
private String lv_arr[]={"Red","Green","Blue","Purple","White","Black","Pink","Cyan","Magenta"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lv1=(ListView)findViewById(R.id.MessageList);
lv1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));
}
}
为什么在ListView本身可滚动时将ListView放在ScrollView中? – TofferJ 2011-05-17 10:29:11
欢迎来到stackoverflow的方式。如果您发现答案回答了您的问题,请接受它并/或向上提问。另外,请在发布问题之前仔细检查拼写和搜索重复项,如下所述:http://stackoverflow.com/questions/how-to-ask – vidstige 2011-05-17 15:08:49