RecyclerView 切换数据源导致界面空白问题

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/piyun1993/article/details/52936502


BUG:

在做过滤器时,用的是同一个RecyclerView,RecyclerView有加有固定头部,第一类过滤有很多数据超过一屏,第二类没有数据,当第一类数据滑过一屏,切换至第二类时,固定头部上方留有大段空白


解决方案:

将RecyclerView移动至头部

	mStaggeredManager.scrollToPositionWithOffset(0, -mUserInfoViewPagerHeight);


展开阅读全文

界面之间的切换问题

09-28

总共有三个界面,一个主界面(main),有两个button按钮rn点击按钮会切换到另外一个界面(clock2),clock2上也有一个返回按钮,想让他返回主界面(main),rn但在程序运行的时候出错。[code=Java][/code]package net.blogjava.mobile;rnrnimport android.app.Activity;rnimport android.app.AlarmManager;rnimport android.app.PendingIntent;rnimport android.content.Intent;rnimport android.os.Bundle;rnimport android.util.Log;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.widget.Button;rnrnpublic class TestHandClock2 extends Activity implements OnClickListenerrn String ATG = "KKKKKKKKK";rn rn @Overridern public void onCreate(Bundle savedInstanceState) rn Log.v(ATG, "onclick haved111111 ");rn super.onCreate(savedInstanceState);rn setContentView(R.layout.handclock2);rn Button backButton = (Button)findViewById(R.id.returnMain1);rn Log.v(ATG, "onclick haved22222222 ");rn backButton.setOnClickListener(this);rn Log.v(ATG, "onclick haved3333333333 ");rn rnrn @Overridern public void onClick(View arg0) rn // TODO Auto-generated method stubrn rn Intent intent = null;rn intent = new Intent(this, Main.class);rn Log.v(ATG, "onclick haved44444 ");rn startActivity(intent);rn rnrn主界面的代码是:rn[code=Java][/code]package net.blogjava.mobile;rnrnimport android.app.Activity;rnimport android.content.Intent;rnimport android.os.Bundle;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.widget.Button;rnrnpublic class Main extends Activity implements OnClickListenerrnrnrn @Overridern public void onClick(View view)rn rn Intent intent = null;rn switch (view.getId())rn rn case R.id.btnHandClock1:rn intent = new Intent(this, TestHandClock1.class);rn startActivity(intent);rn break;rn case R.id.btnHandClock2:rn intent = new Intent(this, TestHandClock2.class);rn startActivity(intent);rn break;rn rn rnrn @Overridern public void onCreate(Bundle savedInstanceState)rn rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn Button btnHandClock1 = (Button)findViewById(R.id.btnHandClock1);rn Button btnHandClock2 = (Button)findViewById(R.id.btnHandClock2);rn rn btnHandClock1.setOnClickListener(this);rn btnHandClock2.setOnClickListener(this);rn rnrn 论坛

没有更多推荐了,返回首页