「android:drawableLeft」を使用してレイアウトに画像アイコンを設定しました。これは私のレイアウトコードです:
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/textView1"
android:layout_marginLeft="8dp"
android:drawableLeft="@drawable/ic_launcher"
android:gravity="left"/>
私がする必要があるのは、クラスを使用してこの画像を別のものに変更することです。これは、BaseExpandableListAdapter で拡張された Adapter クラス内で使用したコードです。
if (convertView == null) {
convertView = inflater.inflate(R.layout.listrow_details, null);
}
((CheckedTextView) convertView).setCheckMarkDrawable(R.drawable.ic_folder);
しかし、これは使用済みの画像を置き換えるものではありません。代わりに、同じ行に追加されます。現在の画像を新しい画像に置き換えるにはどうすればよいですか?