Android中的自定义SwipeRefreshLayout

时间:2016-12-05 11:12:23

标签: android swiperefreshlayout

当我进行刷新时,如何为自定义布局充气?我的代码在这里:一个存在一个加载器的布局,下面是一个TextView

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    shareImg = (ImageView) findViewById(R.id.shareImg);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
    Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/HelveticaNeueLT.otf");
    homeHeaderTxt = (TextView) findViewById(R.id.homeHeaderTxt);
    homeHeaderTxt.setTypeface(tf);
    getSupportActionBar().hide();
    loadDashBoard();

    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            loadDashBoard();
            new Handler().postDelayed(new Runnable() {
                @Override public void run() {
                swipeRefreshLayout.setRefreshing(false);
                }

            }, 5000);

        }
    });
}

0 个答案:

没有答案