本文整理匯總了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);
}
示例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()));
}
示例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()));
}
示例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()));
}
示例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(); //設置監聽事件
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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()));
}