利用ScrollView滑动属性实现点击查看更多

利用ScrollView的滚动实现点击查看更多

  • 效果图

P1
P2
P3

更新内容布局

<ScrollView
    android:id="@+id/sv_des"
    android:layout_width="match_parent"
    android:layout_height="@dimen/DIMEN_120PX"
    android:layout_marginLeft="@dimen/DIMEN_50PX"
    android:layout_marginRight="@dimen/DIMEN_50PX"
    android:layout_marginTop="@dimen/DIMEN_20PX"
    android:overScrollMode="never"
    android:scrollbars="none" >

    <TextView
        android:id="@+id/tv_des"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:lineSpacingExtra="@dimen/DIMEN_10PX"
        android:textColor="#FF262626"
        android:textSize="@dimen/DIMEN_28PX" />
</ScrollView>

了解更多布局

<TextView
    android:id="@+id/tv_loadMove"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/DIMEN_50PX"
    android:paddingTop="@dimen/DIMEN_30PX"
    android:singleLine="true"
    android:text="@string/update_tip_load_more"
    android:textColor="#FF0E76A8"
    android:textSize="@dimen/DIMEN_26PX" />

获取控件

获取ScrollView

ScrollView mSvDes = (ScrollView) view.findViewById(R.id.sv_des);

获取了解更多

// 了解更多
TextView mTvLoadMove = (TextView) view.findViewById(R.id.tv_loadMove);

控制ScrollView滚动

向上滚动ScrollView的高度的距离,显示下部分内容

mSvDes.smoothScrollTo(0, mSvDes.getScrollY() + mSvDes.getMeasuredHeight());
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值