簡體   English   中英

將圖像裁剪到角落

[英]Crop Image android to Corners

您好,我對注釋_日志有一個布局,我使用Aquery Android My Xml LAYOUT

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="left"
    android:background="@android:color/white"
    android:layout_marginTop="15dp"
    android:paddingRight="8dp">


    <ImageView
        android:id="@+id/image_comments"
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:src="@drawable/ic_launcher"
        android:padding="10dp"
        android:layout_alignParentLeft="true"
        android:cropToPadding="true"
        android:scaleType="centerCrop" />


    <TextView
        android:id="@+id/message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@android:color/black"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/image_comments"
        android:layout_toEndOf="@+id/image_comments" />


</RelativeLayout> 

我的班級,image_url是我要在服務器中輸入url的變量:

String image_url="example_for_image_url_string"

int layout_id = R.layout.layout_comment_left;

RelativeLayout relativeLayout = (RelativeLayout) inflater.inflate(layout_id, null, false);
                                AQuery aq = new AQuery(relativeLayout);
                                aq.id(R.id.image_comments).image(image_url);




 TextView message = (TextView) relativeLayout.findViewById(R.id.message);
                            message.setText(message_json);
                            layout.addView(relativeLayout);

求助,如何設置或將我的圖像轉換成圓形,我需要彎曲一個角或半徑

問候!

我通過以下方式解決了這個問題:

AQuery aq = new AQuery(relativeLayout);
ImageOptions options = new ImageOptions();

options.round = 105;

aq.id(R.id.image_comments).image(image_url,options);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM