如何使按钮上的可绘制更小?图标太大,实际上高于按钮.这是我正在使用的代码:
<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) 我已经尝试了几个我能找到的答案,但没有一个能与最新的Facebook Android SDK 4.0一起使用.
如何使用最新的SDK更改布局高度?
android facebook android-xml facebook-login facebook-sdk-4.0
与Facebook Android SDK 3.0相关的问题类似于...
是否可以在SDK 3.5中使用我自己的图像作为Facebook登录按钮,而无需自定义SDK本身?
使用链接问题中给出的答案:
<com.facebook.widget.LoginButton
xmlns:fb="http://schemas.android.com/apk/res-auto"
android:id="@+id/login_button"
android:layout_width="249dp"
android:layout_height="45dp"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:contentDescription="@string/login_desc"
android:scaleType="centerInside"
fb:login_text=""
fb:logout_text="" />
Run Code Online (Sandbox Code Playgroud)
和:
final LoginButton button = (LoginButton) findViewById(R.id.login_button);
button.setBackgroundResource(R.drawable.facebook);
Run Code Online (Sandbox Code Playgroud)
我看到两个带有新SDK的图像.我的图像(R.drawable.facebook)是一个带有白色"f"的大灰色背景.但是,我也看到小白色背景和透明的"f"来自覆盖在背景顶部的原始facebook按钮图标.查看与SDK 3.5登录按钮相关的facebook文档.我想完全删除原来的facebook图标.