android不能滚动

数据采集 2016-09-14 02:55:41
我的首页里,动态加载完数据后,超出窗口的部分就不显示了,而且也不不能下滑,有人知道原因么?

在线等解决方法。
...全文
193 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
MR__P 2016-09-14
  • 打赏
  • 举报
回复
#6和#9都可以,单纯的五大布局是不能滑动的,需要嵌套可滑动的控件。ScrollView,ListView等
qq840727854 2016-09-14
  • 打赏
  • 举报
回复
用 listview 或者 recyclerview 呀
ecstatic 2016-09-14
  • 打赏
  • 举报
回复
起始按照现在这个界面,为什么不使用ListView呢 还有android:scrollbars="none" ScrollView 可以不显示滑动条的
数据采集 2016-09-14
  • 打赏
  • 举报
回复
引用 4 楼 Ecstatic 的回复:
滑动的话,textview本身有滑动属性,另外最好用scrollview套在线性布局外面,保持同方向,这样就可以滑动了
ScrollView只能应用在部分子布局里,不能用到整个activity里,而且,它会显示滚动条。 正常情况下,是不是加载完所有数据,activity应该是自动可以滑动到底部的吧,不应该像我这样,超出窗口的部分就不能滑动吧。
头发还没秃a 2016-09-14
  • 打赏
  • 举报
回复

<ScrollView 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" >
<RelativeLayout 
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
 
    <LinearLayout
        android:id="@+id/index_layout_title"
        android:layout_width="fill_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >
 
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/index_title" />
    </LinearLayout>
 
    <com.copy_food.android.view.BannerView
        android:id="@+id/index_banner"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:layout_marginTop="30dp" >
    </com.copy_food.android.view.BannerView>
 
    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_below="@+id/index_layout_nav1"
        android:layout_marginTop="172dp"
        android:orientation="horizontal" >
 
        <ImageButton
            android:id="@+id/index_ib_news"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_news" />
 
        <ImageButton
            android:id="@+id/index_ib_grouppur"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_grouppurchase" />
 
        <ImageButton
            android:id="@+id/index_ib_weibo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_weibo" />
 
        <ImageButton
            android:id="@+id/index_ib_bargains"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_bargains" />
    </LinearLayout>
 
    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_below="@+id/index_layout_nav2"
        android:layout_marginTop="244dp"
        android:orientation="horizontal" >
 
        <ImageButton
            android:id="@+id/index_ib_weixin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_weixin" />
 
        <ImageButton
            android:id="@+id/index_ib_product"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_product" />
 
        <ImageButton
            android:id="@+id/index_ib_shake"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_shake" />
 
        <ImageButton
            android:id="@+id/index_ib_supply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_supply" />
    </LinearLayout>
 
    <LinearLayout
        android:id="@+id/index_layout_newsinfo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="310dp"
        android:orientation="vertical" >
    </LinearLayout>
 
</RelativeLayout>
</ScrollView>
这样
头发还没秃a 2016-09-14
  • 打赏
  • 举报
回复
你布局最外层再包裹一个scrollView
ecstatic 2016-09-14
  • 打赏
  • 举报
回复
滑动的话,textview本身有滑动属性,另外最好用scrollview套在线性布局外面,保持同方向,这样就可以滑动了
数据采集 2016-09-14
  • 打赏
  • 举报
回复
引用 楼主 keeplove9413 的回复:
我的首页里,动态加载完数据后,超出窗口的部分就不显示了,而且也不不能下滑,有人知道原因么? 在线等解决方法。
引用 1 楼 Ecstatic 的回复:
1.是不是把布局高度写成固定了 2.是不是有控件强滑动条焦点 3.你试试45度滑动,就是斜着能不能滑
可以帮我看下上面的代码么?是不是哪有问题?
数据采集 2016-09-14
  • 打赏
  • 举报
回复
引用 楼主 keeplove9413 的回复:
我的首页里,动态加载完数据后,超出窗口的部分就不显示了,而且也不不能下滑,有人知道原因么? 在线等解决方法。

<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="wrap_content" >

    <LinearLayout
        android:id="@+id/index_layout_title"
        android:layout_width="fill_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/index_title" />
    </LinearLayout>

    <com.copy_food.android.view.BannerView
        android:id="@+id/index_banner"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:layout_marginTop="30dp" >
    </com.copy_food.android.view.BannerView>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_below="@+id/index_layout_nav1"
        android:layout_marginTop="172dp"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/index_ib_news"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_news" />

        <ImageButton
            android:id="@+id/index_ib_grouppur"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_grouppurchase" />

        <ImageButton
            android:id="@+id/index_ib_weibo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_weibo" />

        <ImageButton
            android:id="@+id/index_ib_bargains"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_bargains" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_below="@+id/index_layout_nav2"
        android:layout_marginTop="244dp"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/index_ib_weixin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_weixin" />

        <ImageButton
            android:id="@+id/index_ib_product"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_product" />

        <ImageButton
            android:id="@+id/index_ib_shake"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_shake" />

        <ImageButton
            android:id="@+id/index_ib_supply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1.0"
            android:src="@drawable/ic_grid_tab_supply" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/index_layout_newsinfo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="310dp"
        android:orientation="vertical" >
    </LinearLayout>

</RelativeLayout>
这是代码,我没有设置特别什么。
是不是滑动需要专门控件才支持,还是任何布局控件都支持滑动?
ecstatic 2016-09-14
  • 打赏
  • 举报
回复
1.是不是把布局高度写成固定了 2.是不是有控件强滑动条焦点 3.你试试45度滑动,就是斜着能不能滑

80,490

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧