Toolbar

Activity

@Override
public boolean onOptionsItemSelected(MenuItem item) {

switch (item.getItemId()) {
    case R.id.menu1:
        break;
    case R.id.menu2:
        startActivity(new Intent(MainActivity.this, Main2Activity.class));
        break;
    case android.R.id.home:
        super.onBackPressed();
    default:
        break;
}

return true;

}
刷新加载
//封装一个方法
private void squre() {

map = new HashMap<>();
map.put("page",page+"");
map.put("count","20");
moviePresenter.lb(Api.ZMOVIE, map);

}
//刷新
@Override
public void onRefresh() {

page=1;
Toast.makeText(MainActivity.this,"刷新成功",Toast.LENGTH_SHORT).show();
squre();
xrv.refreshComplete();

}
//加载
@Override
public void onLoadMore() {

page++;
Toast.makeText(MainActivity.this,"已无更多数据",Toast.LENGTH_SHORT).show();
squre();
xrv.loadMoreComplete();

}
//xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toob"
    app:navigationIcon="@drawable/icon_fh"
    android:background="#fcc">

    <TextView
        android:id="@+id/toob_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:text="电影商城"
         android:textSize="18sp"/>

</android.support.v7.widget.Toolbar>

//菜单文件

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/menu1"
        android:title="热门电影"
        app:showAsAction="withText"/>
    <item
        android:id="@+id/menu2"
        android:title="正在上映"
        app:showAsAction="withText"/>
</menu>
//在style文件下改变activity的自带的按钮
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值