直播系统源码,极光IM简单的聊天界面全手动

直播系统源码,极光IM简单的聊天界面全手动实现的相关代码

界面的XML

以下是Activity的布局文件,消息列表我选择用RecyclerView来实现

 

1
<br><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"<br>    xmlns:app="http://schemas.android.com/apk/res-auto"<br>    xmlns:tools="http://schemas.android.com/tools"<br>        android:layout_width="match_parent"<br>        android:layout_height="wrap_content"<br>        android:orientation="vertical"<br>        android:background="@color/beijing"><br>   <RelativeLayout<br>        android:layout_width="match_parent"<br>        android:layout_height="@dimen/Title_Height"<br>        android:background="@color/white"><br> <br>        <ImageView<br>            android:id="@+id/jg_details_back"<br>            android:layout_width="wrap_content"<br>            android:layout_height="match_parent"<br>            android:layout_centerVertical="true"<br>            android:paddingLeft="30px"<br>            android:paddingRight="60px"<br>            android:src="@mipmap/back" /><br>        <TextView<br>            android:id="@+id/jg_details_title"<br>            android:layout_width="match_parent"<br>            android:layout_height="match_parent"<br>            android:gravity="center"<br>            android:text=""<br>            android:textColor="@color/heise"<br>            android:textSize="@dimen/Title_TextSize" /><br> <br>    </RelativeLayout><br> <br>    <android.support.v7.widget.RecyclerView<br>        android:id="@+id/jg_details_recy"<br>        android:layout_width="match_parent"<br>        android:layout_height="0px"<br>        android:layout_weight="1"/><br> <br>    <TextView<br>        android:layout_width="match_parent"<br>        android:layout_height="1px"<br>        android:background="@color/fenge" /><br> <br>    <LinearLayout<br>        android:layout_width="match_parent"<br>        android:layout_height="wrap_content"<br>        android:orientation="horizontal"<br>        android:background="@color/white"<br>        android:paddingLeft="30px"<br>        android:paddingRight="30px"><br> <br> <br>        <EditText<br>            android:id="@+id/jg_details_edit"<br>            android:layout_width="0px"<br>            android:layout_height="wrap_content"<br>            android:layout_marginBottom="20px"<br>            android:layout_marginTop="20px"<br>            android:layout_weight="1"<br>            android:background="@mipmap/sousuo1"<br>            android:gravity="center_vertical"<br>            android:hint="请输入咨询的问题"<br>            android:imeOptions="actionSend"<br>            android:paddingLeft="20px"<br>            android:paddingRight="20px"<br>            android:paddingTop="10px"<br>            android:paddingBottom="10px"<br>            android:singleLine="true"<br>            android:textColor="@color/huise"<br>            android:textCursorDrawable="@null"<br>            android:textSize="14sp" /><br> <br>        <ImageView<br>            android:id="@+id/jg_details_img"<br>            android:layout_width="80px"<br>            android:layout_marginTop="20px"<br>            android:layout_height="80px"<br>            android:layout_marginLeft="20px"<br>            android:src="@mipmap/send_img" /><br> <br>    </LinearLayout><br></LinearLayout>

控件初始化:

 这些代码 放在Activity的onCreate方法中就可以了,

 

其中涉及到的东西都会在下面讲到

1
<br>        title = findViewById(R.id.jg_details_title);<br>        mEdit = findViewById(R.id.jg_details_edit);<br>        mRecycler = findViewById(R.id.jg_details_recy);<br>        mRecycler.setLayoutManager(new LinearLayoutManager(this));<br>        mAdapter = new JG_details_Adapter(this);<br>        mRecycler.setAdapter(mAdapter);<br> <br>        position = getIntent().getIntExtra("position", 0);<br>        //设置消息接收 监听<br>        GlobalEventListener.setJG(this, false);<br> <br>        //进入会话状态,不接收通知栏<br>        JMessageClient.enterSingleConversation(this.userName);

以上就是直播系统源码,极光IM简单的聊天界面全手动实现的相关代码, 更多内容欢迎关注之后的文章

 

posted @   云豹科技-苏凌霄  阅读(336)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示