Android控件之Button图片文字的混排
android:drawableTop="@drawable/img1";上下左右在xml中控制
=============================================================
show = (Button) findViewById(R.id.show);
// 在Android中显示图片信息,必须使用Bitmap
Bitmap bitmapL = BitmapFactory.decodeResource(getResources(),
R.drawable.img1);
ImageSpan imageSpanL = new ImageSpan(bitmapL,DynamicDrawableSpan.ALIGN_BOTTOM);
SpannableString ssL = new SpannableString("img");
ssL.setSpan(imageSpanL, 0, 3,
SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
Bitmap bitmapR = BitmapFactory.decodeResource(getResources(),
R.drawable.img1);
ImageSpan imageSpanR = new ImageSpan( bitmapR,DynamicDrawableSpan.ALIGN_BOTTOM);
SpannableString ssR = new SpannableString("img");
ssR.setSpan(imageSpanR, 0, 3,
SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
show.append(ssL);
show.append("zhongjian");
show.append(ssR);
更多相关文章
- android之Display.getRotation()_传感器控制屏幕旋转
- Android链式方法显示Dialog
- android中使用local_manifest.xml添加软件
- [置顶] androidの下拉菜单Spinner使用
- Android版本28使用http请求报错not permitted by network securi
- Android如何在xml布局中使用自定义属性
- Android(安卓)OneDayOneExample-2. 读取电话本
- android getIdentifier的使用
- android SpannableString使用详解