0
点赞
收藏
分享

微信扫一扫

给TIMSDK的分页GridView Page添加圆点指示器


编者:李国帅


时间:2021-8-6 

问题描述:

在tim sdk中有个自定义分页GridView控件,还是挺好用的,但是没有分页标记,下面的例子给它添加标记。

效果如图:

给TIMSDK的分页GridView Page添加圆点指示器_xml

 

步骤:

        1、找到InputMoreLayout类,添加圆点指示器,其实很多网友都实现过。 

 

给TIMSDK的分页GridView Page添加圆点指示器_android_02

 

        2、布局中chat_inputmore_layout.xml添加

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#D2D2D2" />

<android.support.v4.view.ViewPager
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />

<LinearLayout
android:id="@+id/points"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:gravity="center"
android:orientation="horizontal" />
</LinearLayout>

添加后我们就可以使用了

3、创建Activity,然后加入InputMoreLayout对象

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<com.tencent.qcloud.tim.uikit.modules.chat.layout.inputmore.InputMoreLayout
android:id="@+id/input_extra_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

</LinearLayout>

4、然后修改java代码

给TIMSDK的分页GridView Page添加圆点指示器_pager_03

 

总结:

Android有非常灵活的布局,可以灵活的进行控件的组装。

参考:

​​即时通信 IM SDK API(Android) - 客户端 API - 文档中心 - 腾讯云 (tencent.com)​​

举报

相关推荐

0 条评论