实现正在加载中界面的Android库:DynamicBox

public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_listview); //加载布局文件ListView lv = (ListView)findViewById(R.id.listView); //布局中用来替换的控件// Setup by Boxbox = new DynamicBox(this,lv); // or new DynamicBox(this,R.id.listView)box.setLoadingMessage("Loading your music …");//自定义控件用来替换布局中的替换控件View emptyCollectionView = getLayoutInflater().inflate(R.layout.activity_listview, null, false);box.addCustomView(emptyCollectionView,"music_not_found");box.setClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {Toast.makeText(getApplicationContext(), "Retry button clicked :)", Toast.LENGTH_SHORT).show();} });box.showLoadingLayout();new Handler().postDelayed(new Runnable() {public void run() {// box.showCustomView("music_not_found"); //当数据获取成功时,展示正确的界面box.showExceptionLayout();//当数据获取失败时,显示加载失败的界面}}, 2000);}

,相信成功的信念比成功本身更重要,

实现正在加载中界面的Android库:DynamicBox

相关文章:

你感兴趣的文章:

标签云: