テキストと画像をボタンに入れる必要があり、動的に行う必要があります。XMLコードでそれを行う方法は知っていますが、Javaコードに転送することはできません.
質問する
420 次
2 に答える
1
これを試して、
Button b=new Button(this);
b.setCompoundDrawablePadding(10);
b.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon, 0, 0, 0);
于 2013-08-21T06:55:35.560 に答える
0
このコードを試してください:
button.setCompoundDrawables(Drawable left,Drawable top,Drawable right,Drawable bottom);
于 2013-08-21T06:59:06.440 に答える