Facebook的SDK 3.0的Andr​​oid登录自定义标题栏消失 [英] Facebook SDK 3.0 Android login custom title bar disappears

查看:164
本文介绍了Facebook的SDK 3.0的Andr​​oid登录自定义标题栏消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我启动登录/使用的openSession方法的应用程序标题栏(我们使用自定义的)消失,另外一个显示注册Facebook的活动。有没有一种方法来设置新的活动自定义栏呢?

When I'm launching the login/register Facebook Activity using the openSession method the application title bar (we're using a custom one) disappears and another one appears. Is there a way to set the custom bar for the new Activity as well?

的方式我打电话Facebook的授权:

The way I'm calling the Facebook authorization:

        fb.openSession(this, new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            Logger.d(LOGTAG, "Session moved to state " + state.name());
            if (null == exception) {
                mFacebookSession = session;
                switch (state) {
                case CLOSED:
                case CLOSED_LOGIN_FAILED:
                    mLoginProgressDialog.dismiss();
                    Toast.makeText(FacebookLoginActivity.this, "Login failed. Verify login and password",
                            Toast.LENGTH_LONG).show();
                    break;
                case OPENED:
                case OPENED_TOKEN_UPDATED:
                    mFacebookSession.removeCallback(this);
                    FacebookServer.getInstance(getApplicationContext()).setSession(mFacebookSession);
                    FacebookServer.getInstance(getApplicationContext()).getUserFacebookId(
                            new FacebookLoginActivityUserIDCallback());
                    break;
                case OPENING:
                    break;
                default:
                    mLoginProgressDialog.dismiss();
                    break;
                }
            } else {
                exception.printStackTrace();
            }

        }
    });

我们设立在活动的onCreate()方法调用上述方法的自定义标题栏:

We set up the custom title bar in the onCreate() method of the Activity that calls the above method:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.facebook_login_activity);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.app_title_bar);

下面展示的图片是什么问题:

The images below show what the problem is:

自定义标题栏 发射FB授权之后,简单的标题栏

推荐答案

最后,我只是在Facebook的包中添加了这些行LoginActivity.java:

Ultimately, I simply added these lines to LoginActivity.java in the Facebook package:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.app_title_bar);

这影响了活动FB的布局进行动作和看现在是一致的,当正在启动。

It affected the layout of the activity FB is launching when performing actions and the look is now consistent.

这篇关于Facebook的SDK 3.0的Andr​​oid登录自定义标题栏消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆