安卓开发模块2

该博客介绍了如何在安卓应用中实现通讯录的好友列表展示,利用RecycleView显示好友信息,并详细阐述了点击好友时如何通过PersonalActivity跳转到好友详细页面的过程。内容涵盖xml布局文件的编写、java代码实现以及数据传递的方法。
摘要由CSDN通过智能技术生成

功能介绍:

1. 在通讯录中显示好友

2.点击好友跳转到好友详细页面

思路分析:

 首先创建在页面中添加RecycleView来显示通讯录,并且创建类Friend,其中有两个属性 name与imageid,新建一个PersonalActivity来进行跳转(显示详细信息)。

 实现过程:

java文件:

 

xml文件:

                                    

xml文件编写:

fragment_2.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="Fragment2">

    <!-- TODO: Update blank fragment layout -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="39dp"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/imageView6"
                android:layout_width="43dp"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/nfrd" />

            <TextView
                android:id="@+id/textView5"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="新的朋友"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="41dp"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/imageView7"
                android:layout_width="43dp"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/fri" />

            <TextView
                android:id="@+id/textView6"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="仅聊天的朋友"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="37dp"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/imageView8"
                android:layout_width="43dp"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/qunliao" />

            <TextView
                android:id="@+id/textView7"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="群聊"
                android:textSize="25sp" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="37dp"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/imageView9"
                android:layout_width="43dp"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/biaoqian" />

            <TextView
                android:id="@+id/textView8"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="标签"
                android:textSize="25sp" />

        </LinearLayout>

        <LinearLayou
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值