当前位置: 首页>>代码示例>>Java>>正文


Java SwipeRefreshLayout.setProgressViewOffset方法代码示例

本文整理汇总了Java中android.support.v4.widget.SwipeRefreshLayout.setProgressViewOffset方法的典型用法代码示例。如果您正苦于以下问题:Java SwipeRefreshLayout.setProgressViewOffset方法的具体用法?Java SwipeRefreshLayout.setProgressViewOffset怎么用?Java SwipeRefreshLayout.setProgressViewOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.widget.SwipeRefreshLayout的用法示例。


在下文中一共展示了SwipeRefreshLayout.setProgressViewOffset方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initViews

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void initViews() {
    setContentView(R.layout.activity_messages);

    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
    swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimary, R.color.colorPrimaryDark);
    swipeRefreshLayout.setProgressViewOffset(false, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));

    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    recyclerView.setHasFixedSize(true);
    mLayouManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(mLayouManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());

    adapter = new SampleAdapter();
    recyclerView.setAdapter(adapter);
}
 
开发者ID:ymqq,项目名称:CommonFramework,代码行数:18,代码来源:MessagesActivity.java

示例2: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView(){
    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.staggered_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.staggered_recycler);
    mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.staggered_swipe_refresh) ;
    swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary,R.color.colorPrimaryDark,R.color.colorAccent);
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:StaggeredActivity.java

示例3: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView(){
    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.line_coordinatorLayout);
    recyclerview=(RecyclerView)findViewById(R.id.line_recycler);
    mLayoutManager=new LinearLayoutManager(this);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.line_swipe_refresh) ;
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:LineActivity2.java

示例4: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView(){
    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.line_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.line_recycler);
    mLayoutManager=new LinearLayoutManager(this);

    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.line_swipe_refresh) ;
    swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary,R.color.colorPrimaryDark,R.color.colorAccent);
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:LineActivity.java

示例5: onViewCreated

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    cartoon_type = getArguments().getInt("classid");
    //判断网络部分
    NetworkInfo netIntfo = null;
    Activity act = (Activity) getContext();
    try {
        ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(act.CONNECTIVITY_SERVICE);
        netIntfo = cm.getActiveNetworkInfo();
    } catch (Exception e) {
        Toast.makeText(act, "没有网络权限,请给予相关权限", Toast.LENGTH_SHORT).show();
    }
    if (netIntfo == null) {
        return;
    }
    //初始化布局
    mrecyclerView = (RecyclerView) view.findViewById(R.id.recycler_homepager);
    mgridLayoutManager = new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false);
    mrecyclerView.setLayoutManager(mgridLayoutManager);
    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.grid_swipe_refresh);
    // 这句话是为了,第一次进入页面的时候显示加载进度条
    swipeRefreshLayout.setProgressViewOffset(false, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));
    mAdapter = null;
    isPrepared = true;
    isFirstLoad = true;
    lazyLoad();

    //   new GetData().execute(MainActivity.URL_PREFIX+"/hot?page="+page);
    setListener(); //设置监听事件
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:32,代码来源:ContentHomeFragment.java

示例6: onCreate

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_orange_light, android.R.color.holo_red_light, android.R.color.holo_green_light);
    swipeRefreshLayout.setProgressViewOffset(true, 0, AppUtils.dip2px(this, 24));
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setRefreshing(true);


    sRecyclerView = (SRecyclerView) findViewById(R.id.recycler_view);

    mDataList.add("nihao");
    mDataList.add("nihao");
    mDataList.add("nihao");
    mDataList.add("nihao");
    mDataList.add("nihao");
    mDataList.add("nihao");

    adapter = new TestAdapter();
    adapter.setDataList(mDataList);
    swipeRefreshLayout.setRefreshing(false);

    sRecyclerViewAdapter = new SRecyclerViewAdapter(adapter);
    sRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    sRecyclerView.setHasFixedSize(true);
    sRecyclerView.setLoadMoreEnabled(true);
    sRecyclerView.setAdapter(sRecyclerViewAdapter);
}
 
开发者ID:magicbaby810,项目名称:SRecyclerView,代码行数:33,代码来源:MainActivity.java

示例7: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView(){
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.behavior_demo_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.behavior_demo_recycler);
    mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.behavior_demo_swipe_refresh) ;
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));//调整下拉控件位置

    fab=(FloatingActionButton) findViewById(R.id.fab);
}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:16,代码来源:MyBehaviorActivity.java

示例8: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView(){
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.bottom_sheet_demo_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.bottom_sheet_demo_recycler);
    mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.bottom_sheet_demo_swipe_refresh) ;
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));//调整下拉控件位置

    design_bottom_sheet_bar=(RelativeLayout) findViewById(R.id.design_bottom_sheet_bar);

    design_bottom_sheet=(RelativeLayout) findViewById(R.id.design_bottom_sheet);
    bottom_sheet_iv=(ImageView) findViewById(R.id.bottom_sheet_iv);
    bottom_sheet_tv=(TextView) findViewById(R.id.bottom_sheet_tv);

    behavior = BottomSheetBehavior.from(design_bottom_sheet);

}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:23,代码来源:BaiduMapSample.java

示例9: onViewCreated

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // 实例化刷新布局
    mAdapter = new DynamicViewAdapter(getActivity(), mList);
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
    mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light,
            android.R.color.holo_red_light,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light);
    TypedValue typed_value = new TypedValue();
    getActivity().getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, typed_value, true);
    mSwipeRefreshLayout.setProgressViewOffset(false, 0, getResources().getDimensionPixelSize(typed_value.resourceId));
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // 下拉刷新
            page = 1;
            new LoadDynamicList().execute();
        }
    });
    mSwipeRefreshLayout.setRefreshing(true);
    // 实例化RecyclerView
    mRecyclerView = (RecyclerView) view.findViewById(R.id.dynamic_list);
    mRecyclerView.setAdapter(mAdapter);
    final LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            int visibleItemCount = mLayoutManager.getChildCount();
            int totalItemCount = mLayoutManager.getItemCount();
            int pastVisiblesItems = mLayoutManager.findFirstVisibleItemPosition();
            if (!loading) {
                //当前不在加载,才进行新的加载
                if ((visibleItemCount + pastVisiblesItems) >= totalItemCount) {
                    // 达到底部加载更多

                    //设置flag,标记当前正在刷新(加载)
                    loading = true;
                    mSwipeRefreshLayout.setRefreshing(true);
                    new LoadDynamicList().execute();
                }
            }
        }
    });
    // 开始载入动态操作
    new LoadDynamicList().execute();
}
 
开发者ID:moe2studio,项目名称:PangciACG,代码行数:52,代码来源:HomeFragment.java

示例10: onViewCreated

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    // 实例化发布问题按钮
    btnPublish = (FloatingActionButton)view.findViewById(R.id.button_publish);
    btnPublish.setOnClickListener(this);
    // 实例化刷新布局
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
    mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light,
            android.R.color.holo_red_light,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light);
    TypedValue typed_value = new TypedValue();
    getActivity().getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, typed_value, true);
    mSwipeRefreshLayout.setProgressViewOffset(false, 0, getResources().getDimensionPixelSize(typed_value.resourceId));
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // 下拉刷新
            page = 1;
            new LoadQuestionList().execute();
        }
    });
    mSwipeRefreshLayout.setRefreshing(true);
    // 实例化RecyclerView
    mRecyclerView = (RecyclerView) view.findViewById(R.id.question_list);
    final LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new QuestionViewAdapter(getActivity(), mList);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            int visibleItemCount = mLayoutManager.getChildCount();
            int totalItemCount = mLayoutManager.getItemCount();
            int pastVisiblesItems = mLayoutManager.findFirstVisibleItemPosition();
            if (loading) {
                if ((visibleItemCount + pastVisiblesItems) >= totalItemCount) {
                    // 达到底部加载更多
                    loading = false;
                    mSwipeRefreshLayout.setRefreshing(true);
                    new LoadQuestionList().execute();
                }
            }
            // 自动隐藏发布按钮
            if (Math.abs(dy) > ScrollOffset)
                if (dy > 0)
                    btnPublish.hide(true);
                else
                    btnPublish.show(true);
        }
    });
    // 开始载入问题操作
    new LoadQuestionList().execute();
}
 
开发者ID:moe2studio,项目名称:PangciACG,代码行数:57,代码来源:ExploreFragment.java

示例11: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView(){
    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.grid_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.grid_recycler);
    mLayoutManager=new GridLayoutManager(GridActivity.this,3,GridLayoutManager.VERTICAL,false);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.grid_swipe_refresh) ;
    //调整SwipeRefreshLayout的位置
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));


}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:GridActivity.java


注:本文中的android.support.v4.widget.SwipeRefreshLayout.setProgressViewOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。