2013-02-12 71 views
-4

我想设置滚动视图。这个怎么做?如何保持滚动视图?

在我的列表视图我有10个项目view..Im只能看到7items..Remanining 3个项目,我需要一个滚动视图,以see..Any可能是有保留scrollview..Please指导我..

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context=".Nexttopic" > 

    <ListView 
     android:id="@+id/List_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" > 
    </ListView> 
</RelativeLayout> 
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     viewList = Nexttopic.this.getLayoutInflater().inflate(R.layout.activity_nexttopic, null); 
     dialogMarketList = new Dialog(Nexttopic.this); 
     dialogMarketList.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     dialogMarketList.setContentView(viewList); 
     dialogMarketList.show();  
     lvForDialog = (ListView) viewList.findViewById(R.id.List_view); 
     ArrayAdapter<String> adapter = (new ArrayAdapter<String>(Nexttopic.this, R.layout.row_topic, R.id.child_row,tnamelist)); 
     lvForDialog.setAdapter(adapter); 
+0

什么意思是“保持ScrollView”? – 2013-02-12 12:23:18

+0

@artemzinnatullin我在列表视图中有10个项目,它只显示7项,我想滚动以查看剩余的3个项目,我无法滚动..请指导我.. – 2013-02-12 12:42:06

回答

0

你应该尝试使用一种叫做:Google 对不起,我的最终答案.Read这样的:列表视图等有inbuild滚动功能。将其封装在任何其他布局中,如LinearLayout或RelativeLayout。如果仍有问题显示某些代码。

EDIT: 

不知道,但尝试这个

  listview.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL); 
+0

我无法滚动.. – 2013-02-12 12:32:01

+0

如何保持滚动视图到列表视图.. – 2013-02-12 12:55:16

+0

列表视图提供了它自己的默认scrollView! – Navdroid 2013-02-12 12:58:43

1

滚动型为的是什么?你的ListView刚才设置的高度match_parent和很会照顾自己滚动项目

使用此布局,而不是使用滚动型

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context=".Nexttopic" > 

    <ListView 
     android:id="@+id/List_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
    </ListView> 
</RelativeLayout> 
+0

在Listview我有10项不滚动,我看不到滚动... – 2013-02-12 12:29:16

+0

发布您的活动代码有问题 – Pratik 2013-02-12 12:31:46

+0

看到我的代码..在问题 – 2013-02-12 12:47:20

0

没有必要把滚动视图为ListView。它将根据列表视图中的行数自动滚动。

+0

不,我可以无法滚动 – 2013-02-12 12:32:23

相关问题