相关疑难解决方法(0)

如何缩小按钮上的drawable?

如何使按钮上的可绘制更小?图标太大,实际上高于按钮.这是我正在使用的代码:

    <Button
    android:background="@drawable/red_button"
    android:drawableLeft="@drawable/s_vit"
    android:id="@+id/ButtonTest"
    android:gravity="left|center_vertical" 
    android:text="S-SERIES CALCULATOR"
    android:textColor="@android:color/white"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_marginLeft="25dp"
    android:layout_marginRight="25dp"
    android:drawablePadding="10dp">
    </Button>
Run Code Online (Sandbox Code Playgroud)

鞋面是它应该看起来的样子,它现在看起来越低.

鞋面是它应该看起来的样子,它现在看起来越低.

我尝试了这个,但没有显示图像.:-(

    Resources res = getResources();
    ScaleDrawable sd = new ScaleDrawable(res.getDrawable(R.drawable.s_vit), 0, 10f, 10f);
    Button btn = (Button) findViewById(R.id.ButtonTest);
    btn.setCompoundDrawables(sd.getDrawable(), null, null, null);
Run Code Online (Sandbox Code Playgroud)

android scale compound-drawables

82
推荐指数
5
解决办法
10万
查看次数

CompoundDrawable大小

在某些情况下,Android-Lint给了我这个暗示:

此标签及其子代可以替换为一个和复合drawable

我可以在某些地方这样做,但在其他地方,缩放图像很重要,我无法做到.有没有选项可以设置复合可绘制的大小?

android

26
推荐指数
3
解决办法
3万
查看次数

标签 统计

android ×2

compound-drawables ×1

scale ×1