Facebook LoginActivity is not shown properly

2020-07-18 08:45发布

问题:

I have an application that uses Facebook login. I have the FacebookSDK and I use com.facebook.LoginActivity.

The problem is that on 10" tablets the activity is not shown properly when the softkeybord is shown. I'm using a Samsung Galaxy Tab 2 (10.1) (OS 4.0.2).

This is what I see after clicking on one EditText in the Facebook LoginActivity:

In the manifest file I have:

<activity
    android:name="com.facebook.LoginActivity"
    android:windowSoftInputMode="adjustResize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:label="@string/app_name" >
</activity>

Is anyone else having this problem too? Is anyone using LoginActivity without having problems?

Is there anything else I need to do?

And why does not the Facebook activity take the full screen ?

回答1:

The quick fix will require you to modify the SDK code.

Look in the WebDialog.java file, in the onCreate() method, after the super.onCreate() call, add this:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

This will pan the soft keyboard over top of the dialog. If that's still not enough, then you might want to play around with the margins in the getMargins() method. In the worst case, you can just have getMargins return:

return new Pair<Integer, Integer>(1, 1);


回答2:

Why in the world are you using com.facebook.LoginActivity? Just authenticate your session using a facebook Session and authenticate through SSO or if not available through the web.

Update

Refer to this URL about SSO:

http://facebooksso.blogspot.com/2012/04/single-sign-on-facebook.html