[英]android - how to put imageview on top of textview letter?
只需使用android:drawableTop="@drawable/YOUR_DRAWABLE"
簡單即可。
要設置運行時,請使用代碼-
imgView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.imgSrc, 0, 0);
如果不想添加,請在此處(0,R.drawable.imgSrc,0,0)左上右下0。
在您的XML上使用它
android:drawableTop="@drawable/your_image"
android:drawablePadding="10dp"
或在您的活動課上
textView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.your_image, 0, 0);
textView.setCompoundDrawablePadding(10);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.