Android图片编辑,画箭头,画圆,画矩形(等)

本文介绍了在Android中如何实现图片编辑功能,包括绘制箭头、圆形和矩形,适用于聊天应用中发送图片前的编辑操作。提供了布局代码和Activity代码示例,并提到了一个全面的图片编辑库PhotoEditDemo作为参考。
摘要由CSDN通过智能技术生成
最近再做聊天功能,遇到需求发送图片前编辑,查了好多没见一个合适的,就自己写了一个,希望对看到的人有所帮助(抛砖引玉),因为时间仓促请忽视编码风格

-箭头原理图

这里写图片描述

-效果图

这里写图片描述


-布局代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:id="@+id/ll"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    <LinearLayout
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        <ImageView
                android:id="@+id/iv"
                android:scaleType="fitCenter"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>
    </LinearLayout>
    <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="40dp">
        <Button
                android:layout_weight="1"
                android:onClick="pics"
                android:text="相册"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:layout_weight="1"
                android:onClick="photo"
                android:text="拍照"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:background="@android:color/holo_red_dark"
                android:onClick="red"
                android:text="红"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:background="@android:color/holo_green_dark"
                android:onClick="green"
                android:text="绿"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:background="@android:color/holo_blue_dark"
                android:onClick="blue"
                android:text="蓝"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
    </LinearLayout>
    <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="40dp">
        <Button
                android:layout_weight="1"
                android:onClick="small"
                android:text="细"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:layout_weight="1"
                android:onClick="zhong"
                android:text="中"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:layout_weight="1"
                android:onClick="big"
                android:text="粗"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:layout_weight="1"
                android:onClick="arrow"
                android:text="箭头"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:layout_weight="1"
                android:onClick="fang"
                android:text="方"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        <Button
                android:layout_weight="1"
                android:onClick="circle"
                android:text="圆"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值