ボタンの中央にテキストを表示しようとしていますが、そのようにテキストがボタンに完全に収まりません
ここにVとWを表示しようとしていますが、スペースもありますが、収まりません。助けてください
スタイルのテキストはこのようなものです
<style name="textstyle">
<item name="android:textSize">15sp</item>
<item name="android:gravity">center</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#000000</item>
</style>
ボタンのサイズは実行時に決定されます
box = new Button(context);
box.setTextAppearance(context, R.style.input_box_textstyle);
Drawable image = context.getResources().getDrawable(R.drawable.inputbox);
box.setBackgroundDrawable(image);
.
.
.
if(size <= n)
{
Log.v("textsize..", width+"");
p = new LinearLayout.LayoutParams(width, height);
}
else
{
p = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 60);
p.weight = 1;
}
box.setLayoutParams(p);
isSet = false;