Scroll CoordinatorLayout使用ScrollBar而不是RecyclerView

时间:2016-03-27 06:50:18

标签: android scrollview android-recyclerview android-coordinatorlayout

有人可以帮助我使用public class NewLogin extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener { @OnClick(R.id.googleSignIn) public void GoogleLogin() { Intent signIn = Auth.GoogleSignInApi.getSignInIntent(client); startActivityForResult(signIn, GOOGLE_SIGN_IN); } GoogleSignInOptions options; GoogleApiClient client; private ProgressDialog mProgressDialog; private static final int GOOGLE_SIGN_IN = 101; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); ButterKnife.bind(this); /** CONFIGURE THE GOOGLE SIGN IN OPTIONS **/ options = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestProfile().build(); client = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, options) .addApi(Plus.API) .build(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == GOOGLE_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); handleSignInResult(result); } } @Override protected void onStart() { super.onStart(); OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(client); if (opr.isDone()) { GoogleSignInResult result = opr.get(); handleSignInResult(result); Log.e("CACHE STATUS", "Got cached sign-in"); } else { showProgressDialog(); opr.setResultCallback(new ResultCallback<GoogleSignInResult>() { @Override public void onResult(GoogleSignInResult googleSignInResult) { hideProgressDialog(); handleSignInResult(googleSignInResult); } }); } } // [START handleSignInResult] private void handleSignInResult(GoogleSignInResult result) { Log.d("handleSignInResult:", String.valueOf(result.isSuccess())); if (result.isSuccess()) { GoogleSignInAccount acct = result.getSignInAccount(); Toast.makeText(getApplicationContext(), acct.getDisplayName(), Toast.LENGTH_SHORT).show(); String name = acct.getDisplayName(); Log.e("DISPLAY NAME", name); String email = acct.getEmail(); Log.e("USER EMAIL", email); String profile = String.valueOf(acct.getPhotoUrl()); Log.e("USER PROFILE", profile); Log.e("ID", acct.getId()); } } private void showProgressDialog() { if (mProgressDialog == null) { mProgressDialog = new ProgressDialog(this); mProgressDialog.setMessage("Loading...."); mProgressDialog.setIndeterminate(true); } mProgressDialog.show(); } private void hideProgressDialog() { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.hide(); } } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { } @Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase)); } } 滚动CoordinatorLayout而不是 ScrollView

  如果没有RecyclerView,它就无法运行。

     

See This Picture

1 个答案:

答案 0 :(得分:0)

如果您的意思是要将RecyclerView替换为ScrollView,请改用NestedScrollView