Android仿QQ讨论组头像效果-创新互联

本文实例为大家分享了Android仿QQ讨论组头像展示的具体代码,供大家参考,具体内容如下

成都创新互联公司是一家专业提供覃塘企业网站建设,专注与做网站、成都网站设计、html5、小程序制作等业务。10年已为覃塘众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。

一、效果图

二、实现

基本实现过程:

1.将原图片读取为bitmap

2.在Canvas画布上计算出图片位置,并绘制新的图片。

(ps:计算位置对我来说是难点,花了好长时间);

三、源码

1.布局文件

<?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="match_parent"
 android:padding="16dp"
 android:background="#AEAEAE"
 android:orientation="vertical">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 android:orientation="horizontal">
 <ImageView
  android:id="@+id/img_src_0"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:padding="5dp"
  android:layout_weight="1"
  android:adjustViewBounds="true"
  />
 <ImageView
  android:id="@+id/img_src_1"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:padding="5dp"
  android:layout_weight="1"
  android:adjustViewBounds="true"
  />
 <ImageView
  android:id="@+id/img_src_2"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:padding="5dp"
  android:layout_weight="1"
  android:adjustViewBounds="true"
  />
 <ImageView
  android:id="@+id/img_src_3"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:padding="5dp"
  android:layout_weight="1"
  android:adjustViewBounds="true"
  />
 <ImageView
  android:id="@+id/img_src_4"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:padding="5dp"
  android:layout_weight="1"
  android:adjustViewBounds="true"
  />
 </LinearLayout>
 <ImageView
 android:id="@+id/img_result_2"
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 />
 <ImageView
 android:id="@+id/img_result_3"
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 />
 <ImageView
 android:id="@+id/img_result_4"
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 />
 <ImageView
 android:id="@+id/img_result_5"
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 />
</LinearLayout>

分享标题:Android仿QQ讨论组头像效果-创新互联
标题来源:https://www.cdcxhl.com/article40/ccioeo.html

成都网站建设公司_创新互联,为您提供面包屑导航响应式网站企业网站制作软件开发App开发ChatGPT

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站托管运营