이전에 비슷한 질문을했지만 저는 제 생각이 다릅니다라고 생각합니다. RecyclerView를 사용하여 재생 목록을 만들려고하는데 노래를 선택하면 원본 이미지가 배경에서 희미하게 보일 수 있지만 노래의 이미지가있는 원형 이미지가 눈금 기호로 변경되기를 원합니다. 내 진드기 이미지를 준비했습니다. 다른 ImageView를 기존 ImageView 위에 동적으로 추가하는 방법은 무엇입니까?
어떻게이 이미지를 기존 ImageView에 동적으로 추가 할 수 있습니까? 음악 이미지 파일이 영역에서 동적으로로드되어 배경이 될 수 없기 때문에 배경 방법에 이미지 하나를 넣는 것이 나에게 해결책이되지 않습니다. 내 RecyclerView 항목에 대한
XML 코드는 다음과 같습니다 :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingRight="10dp"
android:paddingLeft="30dp"
>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="start"
android:transitionName="albumArt"
android:id="@+id/album_art"
android:scaleType="centerCrop"
android:src="@color/colorPrimary"/>
<LinearLayout
android:layout_width="fill_parent"
android:gravity="right"
android:paddingLeft="20dp"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/data"
android:layout_width="match_parent"
android:fontFamily="sans-serif"
android:textColor="#ffffff"
android:text="Music Name"
android:textSize="17sp"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/data_album"
android:layout_width="match_parent"
android:fontFamily="sans-serif"
android:textColor="#bfe0e0e0"
android:textSize="14sp"
android:text="Music Artist"
android:layout_height="wrap_content"
/>
</LinearLayout>
이 어떻게 자바 코드에서 동적으로이 작업을 수행 할 수 있습니까? 어떻게 든 set visibility
을 사용하여이 작업을 수행 할 수 있습니까? 그렇다면 새로운 방법을 설명해 주시면 감사하겠습니다.
'LayerDrawable' 클래스 사용 : * "다른 Drawable의 배열을 관리하는 Drawable. 배열 순서대로 그려 지므로 인덱스가 가장 큰 요소가 맨 위에 그려집니다."* – pskink