사용자의 아바타를 드로어 블로 표시하는 게임이 있습니다. 아바타의 너비는 150dp입니다. 이제 사용자가 온라인 상태인지 아닌지를 나타내는 빨간색 또는 녹색 점을 중앙 하단에 배치하려고합니다. 나는 레드/그린 도트 드로어블을 가지고 있습니다. 도트의 너비/높이는 30dp입니다. 어떻게 그들을 결합합니까?크기가 다른 두 개의 드로어 블을 결합합니다.
지금까지는 피카소 라이브러리를 사용하여 아바타를로드하고있었습니다. 나는 계속 그렇게하고 싶다. 가능할 것인가?
은 내가 @drawable/avatar
하고이 중 하나 @drawable/red_dot
또는 @drawable/green_dot
내가
편집 : 나는 드로어 블 디렉토리 내부 avatar.xml로 저장하는 레이어 목록을 실험되었지만, 이것은 단지 두 개의 같은 크기의 드로어 블 ... 정말 원하는 그렇게하지 뭔가 보여줍니다 :
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/avatarPic"
android:drawable="@drawable/avatar"
android:width="150dp"
android:height="wrap_content"
/>
<item
android:id="@+id/avatarBadge"
android:drawable="@drawable/redDot"
android:width="30dp"
android:height="30dp"
/>
</layer-list>
을
두 번째 편집 :
여기에서 RelativeLayout을 사용했다는 점을 말씀 드리고 싶습니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/avatarPic"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:src="@drawable/avatar" >
</ImageView>
<ImageView
android:id="@+id/avatarBadge"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignBottom="@id/avatarPic"
android:layout_centerHorizontal="true"
android:layout_centerVertical="false"
android:layout_marginBottom="1dp"
android:adjustViewBounds="true"
android:src="@drawable/red_dot" >
</ImageView>
</RelativeLayout>
메인 레이아웃에서이
<include>
태그
하지만 난 드로어 블로드처럼 나는 RelativeLayout의를로드 할 수 없습니다, 맞나요? –
레이아웃에서 드로어 블을 이미지 뷰에로드 할 수 있습니다. – laalto
내가 말하고자하는 것은, 다음과 같이 drawable을 처리하는 것처럼 RelativeLayout을 처리 할 수 없다는 것입니다. 즉, Picasso로로드 할 수없고 크기를 조정할 수 없음을 의미합니다. way –