Skip to content

Instantly share code, notes, and snippets.

古宏亚 guhongya

View GitHub Profile
@guhongya
guhongya / LazyFragment.md
Last active Mar 13, 2018
Android fragment 懒加载
View LazyFragment.md
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 Mar 13, 2018
Android Activity 错误页,异常页 的显示方案
View BaseActivity.md

大概思路

在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">
You can’t perform that action at this time.