2017-10-08 4 views
-1

CircularImageView를 툴바 오른쪽으로 옮기려고 며칠 동안 고심하고 있습니다.툴바에서 CircularImageView를 이동할 수 없습니다.

나는 오른쪽으로 더 중심에두고 싶습니다 (즉, 툴바 가장자리를 건드리지 않고).하지만 할 수 없습니다. 정보를 위해서, 나는 mikhaellopez와 hdodenhof 라이브러리를 성공없이 사용하려고했습니다. 내가합니다 (CircularImageView에서 자리 표시 자 이미지) 시도 여기에서

:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 

    android:id="@+id/page_toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:layout_alignParentTop="true" 
    android:background="@color/primary" 
    android:elevation="4dp" 
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <com.mikhaellopez.circularimageview.CircularImageView 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/profile_pic" 
     android:layout_width="wrap_content" 
     android:layout_height="48dp" 
     android:layout_alignParentEnd="true" 
     android:src="@drawable/ic_seed_48dp" 
     app:civ_border_color="#FFFFFF" 
     app:civ_border_width="3dp" /> 

    </RelativeLayout> 
</android.support.v7.widget.Toolbar> 
public class HomepageActivity extends AppCompatActivity { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.homepage_activity); 
     pageToolbar = (Toolbar) findViewById(R.id.page_toolbar); 
     setSupportActionBar(pageToolbar); 
     ... 
} 

This is the result

또 다른 질문 : 가능 일반 배경으로 CircularImageView을하는 것입니다 (예 : 화이트)? 실제로 그 안에 무언가를 넣지 않으면 표시되지 않으며 자리 표시 자 이미지를 넣어야합니다.

미리 감사드립니다.

답변

0

네, 그것은 단지 일반 배경을 사용할 수 있습니다, 당신이 시도 할 수 없습니다 당신이 사용하고있는 라이브러리에 대한하지만 hdodenof의의와 :

app:civ_fill_color="@android:color/white" 

또한 당신의 CircularImageView

이 추가 시도
android:layout_alignParentRight="true" 

android:layout_alignParentEnd="true"은 RTL 레이아웃에 대한 백업 지원으로, LTR 대신 RTL에서 레이아웃을 렌더링하는 앱을 만드는 동안 사용됩니다.

+0

이제 정상 작동합니다. 감사합니다. 그냥 질문 : CircularImageView가 뭔가를 넣지 않으면 사라집니다. 간단한 흰색 배경으로 그걸 가질 수있는 방법이 있습니까? – Benny

+0

예 : hdodenhof의 라이브러리를 사용하고 있다면 이것을 시도하십시오 :'app : civ_fill_color = "@ android : color/white"' 나는 그것이 당신에게 효과적이라고 기쁩니다. pls는 답으로 그것을 표시하므로 다른 사람도 그것으로부터 이익을 얻습니다. – MadScientist

관련 문제