0
我把帳戶的照片放在導航標題中。邊框是矩形的,我想把它做成圓形,我該怎麼做? 在這段代碼中,我使用Glide來顯示圖像。在Android Studio中,如何更改帶有圓角邊框的Google帳戶的照片?
my_header_navigation.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="@color/common_google_signin_btn_text_dark_focused"
android:id="@+id/navigation_header">
<ImageView
android:id="@+id/photoImageView"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="16dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="18dp"
android:background="@color/colorAccent"
android:visibility="invisible" />
</RelativeLayout>
,並在主要活動:
private ImageView photoImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
View hView = navigationView.getHeaderView(0);
photoImageView = hView.findViewById(R.id.photoImageView);
if(user != null){
Glide.with(List.this).load(user.getPhotoUrl()).into(photoImageView);
photoImageView.setVisibility(View.VISIBLE);
}
else{
photoImageView.setVisibility(View.INVISIBLE);
}
謝謝你的傢伙,它適合我! 但是,如果沒有這下面的任務,我不知道爲什麼。 '應用:civ_border_color = 「#EEEEEE」 應用:civ_border_width = 「4DP」 應用:civ_shadow = 「真」 應用:civ_shadow_radius = 「10」 應用:civ_shadow_color = 「#8BC34A」' –
你需要申報程序外部LinearLayout或RelativeLayout中的變量是您設計的依賴關係,我將編輯我的答案,現在檢查它,如果可以,請投票+1我的答案,問候 –