本文整理汇总了Java中android.support.v4.widget.SwipeRefreshLayout.setColorSchemeResources方法的典型用法代码示例。如果您正苦于以下问题:Java SwipeRefreshLayout.setColorSchemeResources方法的具体用法?Java SwipeRefreshLayout.setColorSchemeResources怎么用?Java SwipeRefreshLayout.setColorSchemeResources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.widget.SwipeRefreshLayout
的用法示例。
在下文中一共展示了SwipeRefreshLayout.setColorSchemeResources方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViews
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void initViews(View view) {
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
refresh = (SwipeRefreshLayout) view.findViewById(R.id.refreshLayout);
//设置下拉刷新的按钮的颜色
refresh.setColorSchemeResources(R.color.colorPrimary);
fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setRippleColor(getResources().getColor(R.color.colorPrimaryDark));
tabLayout = (TabLayout) getActivity().findViewById(R.id.tab_layout);
}
示例2: onCreate
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
isConnected = Utility.checkNetworkConnection(this);
refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refresh_layout);
refreshLayout.setOnRefreshListener(this);
refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
listView = (ListView) findViewById(R.id.lv);
adapter = new NewsAdapter(this, R.layout.listview_item);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
if (isConnected) new LoadNewsTask(adapter).execute();
else Utility.noNetworkAlert(this);
}
示例3: initView
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void initView() {
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_user_list);
RecyclerView.LayoutManager manager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(manager);
recyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
userListAdapter = new UserListAdapter(this);
recyclerView.setAdapter(userListAdapter);
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.fab_Ripple_color,R.color.snack_bar_background);
//从列表顶部向下拉动的时候触发
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
presenter.requestUserData();
}
});
}
示例4: init
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
* 初始化
* @param refreshLayout
* @param listener
*/
public static void init(SwipeRefreshLayout refreshLayout, SwipeRefreshLayout.OnRefreshListener listener) {
refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
refreshLayout.setOnRefreshListener(listener);
}
示例5: initViews
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void initViews(View view) {
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setRippleColor(getResources().getColor(R.color.colorPrimaryDark));
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refreshLayout);
//设置下拉刷新的按钮的颜色
refreshLayout.setColorSchemeResources(R.color.colorPrimary);
}
示例6: 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()));
}
示例7: onStart
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.fb_Swipe);
swipeRefreshLayout.setRefreshing(true);
swipeRefreshLayout.setColorSchemeResources(
R.color.loadingColor_1,
R.color.loadingColor_2,
R.color.loadingColor_3);
swipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
try {
if (getData.getStatus() != AsyncTask.Status.RUNNING) {
if (getData.getStatus() == AsyncTask.Status.FINISHED){
getData = new GetDataTask();
getData.execute();
} else {
getData.execute();
}
}
} catch (Exception e) {
Toast.makeText(getContext(), R.string.verifique, Toast.LENGTH_SHORT).show();
swipeRefreshLayout.setRefreshing(false);
}
}
}
);
fbAdapter = new FacebookAdapter(timelinePosts);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
fbRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_facebook);
fbRecyclerView.setLayoutManager(mLayoutManager);
fbRecyclerView.setAdapter(fbAdapter);
}
示例8: initViews
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public void initViews(View view) {
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refreshLayout);
//设置下拉刷新的按钮的颜色
refreshLayout.setColorSchemeResources(R.color.colorPrimary);
}
示例9: initNavigation
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initNavigation() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navView = (NavigationView) findViewById(R.id.nav_view);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
}
navView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_devices:
break;
case R.id.nav_lab:
break;
case R.id.nav_information:
break;
case R.id.nav_settings:
break;
case R.id.nav_about:
break;
}
mDrawerLayout.closeDrawers();
return true;
}
});
mSwipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
mSwipeRefresh.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (mMeshSvc != null && !mMeshSvc.isOnline()) {
refreshDeviceNode();
}
}
});
}
示例10: onCreateView
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View myFragmentView = inflater.inflate(R.layout.fragment_faltas_lista, container, false);
//Pega o mês definido pelo Downloader
mes = getArguments().getInt("mes",1);
//Obtem da View
mRecyclerView = (RecyclerView) myFragmentView.findViewById(R.id.rv_faltas);
mRecyclerView.setHasFixedSize(true);
//Define o LinearLayoutManager, que exibe os itens na vertical
LinearLayoutManager llm = new LinearLayoutManager(getActivity());
llm.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(llm);
//Obtem da View
mSwipeRefreshLayout = (SwipeRefreshLayout) myFragmentView.findViewById(R.id.srl_falta);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorPrimaryDark);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Recarregar();
mSwipeRefreshLayout.setRefreshing(false);
}
});
//Pega as faltas definidas
ArrayList<Falta> n = getArguments().getParcelableArrayList("faltas");
//Define as faltas no Adapter
FaltaAdapter adapter = new FaltaAdapter(getActivity(), n);
mRecyclerView.setAdapter(adapter);
return myFragmentView;
}
示例11: onCreateView
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View myFragmentView = inflater.inflate(R.layout.fragment_notas_lista, container, false);
//Pega o bimestre definido pelo Downloader
bimestre = getArguments().getInt("bimestre",1);
//Obtem da View
mRecyclerView = (RecyclerView) myFragmentView.findViewById(R.id.rv_notas);
mRecyclerView.setHasFixedSize(true);
//Define o LinearLayoutManager, que exibe os itens na vertical
LinearLayoutManager llm = new LinearLayoutManager(getActivity());
llm.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(llm);
//Obtem da View
mSwipeRefreshLayout = (SwipeRefreshLayout) myFragmentView.findViewById(R.id.srl_nota);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorPrimaryDark);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Recarregar();
mSwipeRefreshLayout.setRefreshing(false);
}
});
//Pega as notas definidas
ArrayList<Nota> n = getArguments().getParcelableArrayList("notas");
//Define as notas no Adapter
NotaAdapter adapter = new NotaAdapter(getActivity(), n);
mRecyclerView.setAdapter(adapter);
return myFragmentView;
}
示例12: onCreateView
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View myFragmentView = inflater.inflate(R.layout.fragment_horario_lista, container, false);
//Pega o dia definido pelo Downloader
dia = getArguments().getInt("dia",1);
//Obtem da View
mRecyclerView = (RecyclerView) myFragmentView.findViewById(R.id.rv_horario);
mRecyclerView.setHasFixedSize(true);
//Define o LinearLayoutManager, que exibe os itens na vertical
LinearLayoutManager llm = new LinearLayoutManager(getActivity());
llm.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(llm);
//Obtem da View
mSwipeRefreshLayout = (SwipeRefreshLayout) myFragmentView.findViewById(R.id.srl_horario);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorPrimaryDark);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Recarregar();
mSwipeRefreshLayout.setRefreshing(false);
}
});
//Pega os horários definidas
ArrayList<Aula> n = getArguments().getParcelableArrayList("aulas");
//Define os horários no Adapter
HorarioAdapter adapter = new HorarioAdapter(getActivity(), n);
mRecyclerView.setAdapter(adapter);
setHasOptionsMenu(true);
return myFragmentView;
}
示例13: onCreate
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 21) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
setContentView(R.layout.activity_weather);
// 初始化各控件
bingPicImg = (ImageView) findViewById(R.id.bing_pic_img);
weatherLayout = (ScrollView) findViewById(R.id.weather_layout);
titleCity = (TextView) findViewById(R.id.title_city);
titleUpdateTime = (TextView) findViewById(R.id.title_update_time);
degreeText = (TextView) findViewById(R.id.degree_text);
weatherInfoText = (TextView) findViewById(R.id.weather_info_text);
forecastLayout = (LinearLayout) findViewById(R.id.forecast_layout);
aqiText = (TextView) findViewById(R.id.aqi_text);
pm25Text = (TextView) findViewById(R.id.pm25_text);
comfortText = (TextView) findViewById(R.id.comfort_text);
carWashText = (TextView) findViewById(R.id.car_wash_text);
sportText = (TextView) findViewById(R.id.sport_text);
swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
swipeRefresh.setColorSchemeResources(R.color.colorPrimary);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navButton = (Button) findViewById(R.id.nav_button);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String weatherString = prefs.getString("weather", null);
if (weatherString != null) {
// 有缓存时直接解析天气数据
Weather weather = Utility.handleWeatherResponse(weatherString);
mWeatherId = weather.basic.weatherId;
showWeatherInfo(weather);
} else {
// 无缓存时去服务器查询天气
mWeatherId = getIntent().getStringExtra("weather_id");
weatherLayout.setVisibility(View.INVISIBLE);
requestWeather(mWeatherId);
}
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
requestWeather(mWeatherId);
}
});
navButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
drawerLayout.openDrawer(GravityCompat.START);
}
});
String bingPic = prefs.getString("bing_pic", null);
if (bingPic != null) {
Glide.with(this).load(bingPic).into(bingPicImg);
} else {
loadBingPic();
}
}
示例14: onCreate
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 21) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
setContentView(R.layout.activity_weather);
//初始化控件
weatherLayout = (ScrollView) findViewById(R.id.weather_layout);
titleCity = (TextView) findViewById(R.id.title_city);
titleUpdateTime = (TextView) findViewById(R.id.title_update_time);
degreeText = (TextView) findViewById(R.id.degree_text);
weatherInfoText = (TextView) findViewById(R.id.weather_info_text);
forecastLayout = (LinearLayout) findViewById(R.id.forecast_layout);
aqiText = (TextView) findViewById(R.id.aqi_text);
pm25Text = (TextView) findViewById(R.id.pm25_text);
comfortText = (TextView) findViewById(R.id.comfort_text);
carWashText = (TextView) findViewById(R.id.car_wash_text);
sportText = (TextView) findViewById(R.id.sport_text);
bingPicImg = (ImageView) findViewById(R.id.bing_pic_img);
swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
swipeRefresh.setColorSchemeResources(R.color.colorPrimary);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navButton = (Button) findViewById(R.id.nav_button);
final String weatherId;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String weatherString = prefs.getString("weather", null);
if (weatherString != null) {
Weather weather = Utility.handleWeatherResponse(weatherString);
weatherId = weather.basic.weatherId;
showWeatherInfo(weather);
} else {
weatherId = getIntent().getStringExtra("weather_id");
weatherLayout.setVisibility(View.INVISIBLE);
requestWeather(weatherId);
}
String bingPic = prefs.getString("bing_pic", null);
if (bingPic != null) {
Glide.with(this).load(bingPic).into(bingPicImg);
} else {
loadBingPic();
}
swipeRefresh.setOnRefreshListener(() -> {
requestWeather(weatherId);
});
navButton.setOnClickListener(v -> {
drawerLayout.openDrawer(GravityCompat.START);
});
}
示例15: initRefreshLayout
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
protected SwipeRefreshLayout initRefreshLayout(View view) {
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout);
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setColorSchemeResources(android.R.color.black);
return mSwipeRefreshLayout;
}