1

問題解決檢查我的回答以下爲了解通知用戶照片的Android的邊境使用滑翔


我想創造出正在從Facebook賬戶下載的資料圖片的邊框。但是,即使在使用計算器學習其他示例之後,我也無法正確執行此操作。正在使用Glide庫下載配置文件圖片。這裏是我的代碼: - 在XML

滑翔庫代碼Java中

Glide.with(Home.this).load(url).asBitmap().into(new BitmapImageViewTarget(profile_pic){ 
      @Override 
      protected void setResource(Bitmap resource) { 
       RoundedBitmapDrawable circular = RoundedBitmapDrawableFactory.create(getApplicationContext().getResources(),resource); 
       circular.setCircular(true); 
       profile_pic.setImageDrawable(circular); 
      } 
     }); 

ImageView的

<ImageView 
     android:id="@+id/profile_pic" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:src="@mipmap/ic_launcher" 
     android:padding = "5dp" 
     android:background="@drawable/profile_pic_border"/> 

在繪製對象

<shape android:shape="oval" 
xmlns:android="http://schemas.android.com/apk/res/android" > 
<stroke 
    android:width="5dp" 
    android:color="#3e65b4"/> 
<size android:height="50dp" 
android:width="50dp"/> 
圖形邊框

下面是我從上面的代碼實現: -

在5.7寸手機5.5inch電話{真正的手機} enter image description here

{}仿真

enter image description here

回答

1

所以,我已經解決了這個問題,採用橢圓形我的代碼是100%正確的。

我所做的是相對佈局,其中我將該圖像固定爲90dp,這使得它不正確,只要我糾正了包裝內容,它就非常適合。附上快照供其他人蔘考。

enter image description here

1

在您的可繪製文件上,而不是使用ova L形,將其更改爲環形狀,以獲得一個完美的圓圈,像這樣:

<shape android:shape="ring" 
xmlns:android="http://schemas.android.com/apk/res/android" > 
+0

這不是幫助 –

+0

你能告訴我環整個代碼,我的環碼不工作?儘管我已經將innerRadius,厚度,厚度比率和使用級別添加爲false –