私は前に尋ねられた同様の質問を知っていますが、私のケースは異なると思います。 私はRecyclerViewを使用してプレイリストを作成しようとしています。曲が選択されている場合、元の画像が背景に色あせて見える間に、曲の画像を保持する円形の画像を目盛り記号に変更します。私は自分のティックイメージを準備している。 既存のImageView上に別のImageViewを動的に追加するにはどうすればいいですか?
どうすればこのイメージを既存のImageViewに動的に追加できますか?音楽イメージファイルがRealmから動的に読み込まれ、バックグラウンドになることはできないため、バックグラウンドでの1つのイメージの配置は私にとっては解決策ではありません。
私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>
は、どのように私はJavaコードから動的にこれを行うことができますか?どういうわけかset visibility
を使ってこれを行うことはできますか?はいの場合は、これを行う新しい方法についても説明してください。
'LayerDrawable'クラスを使用する:*"他のDrawableの配列を管理するDrawable。これらは配列順に描画されるため、最も大きなインデックスを持つ要素が上に描画されます。 – pskink