針對我的代碼運(yùn)行新的Lint工具。它提出了很多很好的建議,但是我無法理解這一建議。此標(biāo)簽及其子標(biāo)簽可以替換為一個(gè)和一個(gè)可繪制的復(fù)合標(biāo)簽問題:檢查是否可以使用復(fù)合drawable將當(dāng)前節(jié)點(diǎn)替換為TextView。包含ImageView和TextView的LinearLayout可以作為復(fù)合可繪制對象更有效地處理這是我的布局<LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="horizontal"android:layout_centerInParent="true"><ImageView android:id="@+id/upImage" android:layout_width="20dp" android:layout_height="20dp" android:layout_gravity="center_vertical" android:scaleType="centerInside" android:src="@drawable/up_count_big"></ImageView><TextView android:id="@+id/LikeCount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="2dp" android:layout_marginBottom="1dp" android:textColor="@color/gray" android:textSize="16sp" android:layout_gravity="center_vertical"></TextView></LinearLayout>有人可以提供在這種情況下如何制作復(fù)合畫的具體示例嗎?
3 回答

慕的地6264312
TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
如果由于某種原因需要通過代碼添加,則可以使用以下代碼:
mTextView.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
左,上,右下方是Drawables
- 3 回答
- 0 關(guān)注
- 537 瀏覽
添加回答
舉報(bào)
0/150
提交
取消