Java android-如何更改facebook登录按钮上的fb徽标大小

Java android-如何更改facebook登录按钮上的fb徽标大小,java,android,facebook-graph-api,facebook-login,facebook-sdk-4.0,Java,Android,Facebook Graph Api,Facebook Login,Facebook Sdk 4.0,所以我有一个Android应用程序,我想登录Facebook。为此,我在布局中实现了Facebook登录按钮。现在是以下代码: <com.facebook.login.widget.LoginButton android:id="@+id/login_button" android:layout_width="300dp" android:layout_height="wrap_content" android:paddingTop="5dp" an

所以我有一个Android应用程序,我想登录Facebook。为此,我在布局中实现了Facebook登录按钮。现在是以下代码:

<com.facebook.login.widget.LoginButton
    android:id="@+id/login_button"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="20dp"
    android:textSize="25dp"
    />

问题是,Facebook徽标太小:

fb徽标太小

有没有办法让它变大


谢谢你的帮助

在dp值上给出您的宽度和高度

或者您必须创建更大尺寸的图像
注意:我相信您已经添加了所有屏幕尺寸的抽绳


cheerz

创建自定义Facebook按钮并更改本机Facebook按钮的可见性:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

    <Button
            android:id="@+id/facebookView"
            android:layout_width="300dp"
            android:layout_height="48dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginBottom="12dp"
            android:background="@drawable/btn_frame"
            android:gravity="center"
            android:text="@string/Sign_in_facebook_button"
            android:textColor="@color/colorAccent" />

    <com.facebook.login.widget.LoginButton
            android:id="@+id/facebookButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="invisible"
            android:layout_marginBottom="12dp" />

 </LinearLayout>

创建一个名为com_facebook_button_icon.xml的drawable添加其中的任何内容FB登录按钮将覆盖它作为drawableleft使用的内容

登录按钮:

   this.setCompoundDrawablesWithIntrinsicBounds(
                AppCompatResources.getDrawable(
                        getContext(), com.facebook.common.R.drawable.com_facebook_button_icon),
                null,
                null,
                null);

创建自定义按钮。将宽度和高度设置为
匹配\u parent
或自定义您自己的按钮。“注意:我相信您已经添加了所有可绘制屏幕尺寸”,这是什么意思?我刚刚尝试给com_facebook_button_icon_blue.png更多像素(从42x42到70x70)并将其添加到drawables,但更改不适应……按钮图像保存在:app\build\intermediates\res\merged\debug\drawable-xxhdpi-v4下,但如果我在此处更改大小,则没有帮助……请遵循此指导原则:“注意:我相信您已经添加了所有可绘图的屏幕大小”我猜这是自动完成的?否则它根本不会显示出来…您的意思是只是检查这些可绘图是否存在或调整它们的大小吗?不,您必须根据给定的文档手动创建或调整图像大小(或通过使用任何软件)并将其导入项目可绘制文件夹。我给android GuidLines提供了有关UI创建的足够详细信息。thx作为答案!我仍然不完全明白:什么是“btn_框架”?我需要设计我自己的按钮图像吗?基本上我创建了我自己的“按钮”,将背景设置为“btn_框架”“基本上是这样的:(但我需要在新的btn_框架图像中自己修改facebook徽标的大小。)如果我只是在上面的代码片段中添加以下行:android:background=“@drawable/btn_框架”?使用新设计的按钮,会怎么样?
facebookView.setOnClickListener(this);
@Override
public void onClick(View v) {
    if (v.getId() == R.id.facebookView){
       facebookButton.performClick();
    }
}
   this.setCompoundDrawablesWithIntrinsicBounds(
                AppCompatResources.getDrawable(
                        getContext(), com.facebook.common.R.drawable.com_facebook_button_icon),
                null,
                null,
                null);