1
When my app opens, the Tab appears like this:
But if I open a new one View and return to the home screen, it already appears like this:
Does anyone know why? And how do I always show up with the shadow? I’m using the template from Live-O.
==================================================================== Mainactivity:
public class MainActivity extends NavigationLiveo implements OnItemClickListener {
private HelpLiveo mHelpLiveo;
public Context contexto = this;
public static String idUser;
@Override
public void onInt(Bundle bundle) {
Intent receive = getIntent();
String[] dadosUser = receive.getStringArrayExtra("dadosusuario");
idUser = dadosUser[0];
String nome_sobrenome = dadosUser[1] + " " + dadosUser[2];
String credito = "Saldo: " +dadosUser[3];
// User Information
this.userName.setText(nome_sobrenome);
this.userEmail.setText(credito);
this.userPhoto.setImageResource(R.drawable.padrao); //Foto do usuario no menu
this.userBackground.setImageResource(R.drawable.ic_user_background_first);
// Creating items navigation
mHelpLiveo = new HelpLiveo();
mHelpLiveo.add(getString(R.string.abrir_perfil), R.mipmap.ic_perfil);
mHelpLiveo.addSeparator(); // Item separator
mHelpLiveo.addSubHeader("Outras opções"); //Item subHeader
mHelpLiveo.add(getString(R.string.config_da_conta), R.mipmap.ic_inbox_black_24dp);
mHelpLiveo.add(getString(R.string.config_do_app), R.mipmap.ic_settings_black_24dp);
mHelpLiveo.add(getString(R.string.ajuda_info), R.mipmap.ic_info);
mHelpLiveo.add(getString(R.string.informar_erro), R.mipmap.ic_report_black_24dp);
//mHelpLiveo.add("");
with(this).startingPosition(2) //Starting position in the list
.addAllHelpItem(mHelpLiveo.getHelp())
.colorNameSubHeader(R.color.nliveo_blue_colorPrimary)
.colorItemSelected(R.color.nliveo_blue_colorPrimary)
.footerItem(R.string.desconectar, R.mipmap.ic_logout)
.setOnClickUser(onClickPhoto)
.setOnPrepareOptionsMenu(onPrepare)
.setOnClickFooter(onClickFooter)
.build();
int position = this.getCurrentPosition();
this.setElevationToolBar(position != 2 ? 15 : 0);
}
}
Tabspagera pter:
public class TabsPagerAdapter extends FragmentPagerAdapter {
public TabsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int index) {
switch (index) {
case 0:
return new feed();
case 1:
return new eventos();
case 2:
return new amigos();
default:
return new feed();
}
}
@Override
public int getCount() {
// get item count - equal to number of tabs
return 3;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "Mural";
case 1:
return "Eventos";
case 2:
return "Conexões";
}
return null;
}
}
Enter your implementation code
– Androiderson
update made with the code. I corrected the name of the template I’m using, it’s Live-O, located here: [link] https://github.com/rudsonlive/NavigationDrawerViewPage-MaterialDesign
– Jhonatan Pereira