We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't use models.add(new NavigationTabBar.Model.Builder. Don't know where is wrong. version:1.2.5 in androidStudio3.0.
package com.wapchief.jpushim; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.view.Display; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.gigamole.navigationtabbar.ntb.NavigationTabBar; import com.wapchief.jpushim.framework.base.BaseAcivity; import com.wapchief.jpushim.framework.system.SystemStatusManager; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class MainActivity extends BaseAcivity { @BindView(R.id.title_bar_back) ImageView mTitleBarBack; @BindView(R.id.title_bar_title) TextView mTitleBarTitle; @BindView(R.id.title_options_img) ImageView mTitleOptionsImg; @BindView(R.id.main_root_vp) ViewPager mMainRootVp; @BindView(R.id.main_nv) NavigationView mMainNv; @BindView(R.id.side_main) DrawerLayout mSideMain; @BindView(R.id.main_root) LinearLayout mMainRoot; @BindView(R.id.main_root_tab) private String[] colors = getResources().getStringArray(R.array.default_preview); private ArrayList<NavigationTabBar.Model> models = new ArrayList<>(); private String[] titles = new String[]{"消息", "联系人", "动态"}; private int[] tabIconGray = new int[]{R.mipmap.icon_tab_message_gray, R.mipmap.icon_tab_im_gray, R.mipmap.icon_tab_d_gray}; private int[] tabIcon = new int[]{R.mipmap.icon_tab_message, R.mipmap.icon_tab_im, R.mipmap.icon_tab_d}; @Override protected int setContentView() { return R.layout.activity_main; } @Override protected void initView() { new SystemStatusManager(this).setTranslucentStatus(R.drawable.shape_titlebar); initNaView(); initSideDrawer(); initTab(); } /*初始化tab标签*/ private void initTab() { for (int i = 0; i < titles.length; i++) { models.add(new NavigationTabBar .Model.Builder(tabIconGray[i], Color.parseColor(colors[0])) .title(titles[i]) .badgeTitle(String.valueOf(i))); } } /*添加监听器,手动设置Main布局的位置*/ private void initSideDrawer() { mSideMain.addDrawerListener(new DrawerLayout.DrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { //获取屏幕的宽高 WindowManager manager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); mMainRoot.layout(mMainNv.getRight(), 0, mMainNv.getRight() + display.getWidth(), display.getHeight()); } @Override public void onDrawerOpened(View drawerView) { } @Override public void onDrawerClosed(View drawerView) { } @Override public void onDrawerStateChanged(int newState) { } }); } /*NavigationView侧滑菜单*/ private void initNaView() { mMainNv.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.side_bar1) { } else if (id == R.id.side_bar2) { } else if (id == R.id.side_bar3) { } else if (id == R.id.side_bar4) { } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.side_main); drawer.closeDrawer(GravityCompat.START); return true; } }); } @Override protected void initData() { } @OnClick({R.id.title_bar_back, R.id.title_options_img}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.title_bar_back: DrawerLayout drawer = (DrawerLayout) findViewById(R.id.side_main); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { drawer.openDrawer(GravityCompat.START); } break; case R.id.title_options_img: break; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO: add setContentView(...) invocation ButterKnife.bind(this); } }
The text was updated successfully, but these errors were encountered:
pass a drawable instead of integer
Sorry, something went wrong.
because it needs a drawable resource, you need to convert your bitmap to Drawable Type.
No branches or pull requests
I can't use models.add(new NavigationTabBar.Model.Builder.
Don't know where is wrong.
version:1.2.5
in androidStudio3.0.
The text was updated successfully, but these errors were encountered: