Skip to content

Instantly share code, notes, and snippets.

View guhongya's full-sized avatar

古宏亚 guhongya

  • 北京
View GitHub Profile
@guhongya
guhongya / LazyFragment.md
Last active March 13, 2018 03:59
Android fragment 懒加载
public abstract class LazyFragment extends BaseFragment {
    protected boolean mVisiable=false;
    protected boolean mCreated=false;
    private boolean isFirst=true;

    protected abstract void loadData();


 @Override
@guhongya
guhongya / BaseActivity.md
Last active March 13, 2018 03:59
Android Activity 错误页,异常页 的显示方案

大概思路

在BaseActivity中加载如下的布局,将要显示的布局,和错误页面,异常页都作为子View添加进FrameLayout中,根据需要显示不同页面。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">