【问题标题】:How to keep scrollview? [closed]如何保持滚动视图? [关闭]
【发布时间】:2013-02-12 12:19:42
【问题描述】:

我想设置滚动视图。如何做到这一点?

在我的 Listview 中,我有 10 个项目要查看..我只能看到 7 个项目..Remanining 3 个项目我需要一个滚动视图才能看到..有任何可能保持滚动视图..请指导我..

<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); 

【问题讨论】:

  • “保持滚动视图”是什么意思?
  • @artemzinnatullin 我在列表视图中有 10 个项目,它只显示 7 个项目,我想滚动查看剩余的 3 个项目,我无法滚动..请指导我..

标签: android scrollview


【解决方案1】:

scrollview 是什么原因?您有 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>

【讨论】:

  • 在 Listview 我有 10 个项目没有滚动,我看不到滚动...
  • 发布有问题的活动代码
  • 查看我的代码..有问题
【解决方案2】:

不需要为列表视图放置滚动视图。它会根据列表视图中的行数自动滚动。

【讨论】:

  • 不,我不能滚动
【解决方案3】:

您应该尝试使用名为 :Google 的东西 对不起我的最后一个答案。阅读这个:Listview 所以有内置的滚动功能。将其封装在任何其他布局中,例如 LinearLayout 或 RelativeLayout。如果您仍然有问题,请显示一些您的代码。

EDIT:

不知道但试试这个

          listview.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);

【讨论】:

  • 我无法滚动...
  • 如何保持滚动视图到列表视图..
  • 列表视图提供了自己的默认滚动视图!!
  • 我无法滚动...请指导我 fnd..
  • 查看编辑尝试使用这可能有效..!
猜你喜欢
  • 1970-01-01
  • 2021-03-17
  • 2010-09-24
  • 1970-01-01
  • 2016-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-15
相关资源
最近更新 更多