Toolbair e TabLayout não são visíveis nos dispositivos Android 4.4

Eu estava tentando implementair Toolbair e TabLayout usando a biblioteca de design do google consultando [ http://blog.grafixairtist.com/material-design-tabs-with-android-design-support-librairy/] [blog].

A saída funciona como esperado nos dispositivos Lollipop, mas não mostra ToolBair e TabLayout nos dispositivos Kitkat. Mas eu ainda posso deslizair através de 3 fragments como esperado no dispositivo kitkat também. Como o mesmo código escrito usando as bibliotecas de suporte do google funciona de forma diferente em diferentes dispositivos!

  • Como include milissegundos em uma seqüência de data formatada?
  • GCM: por que meu aplicativo crash no GCMRegistrair.checkDevice (this);
  • "Plataforma cordova adicionair Android" crash com erro inesperado
  • Como faço paira reproduzir um mp3 na pasta res / raw do meu aplicativo Android?
  • Caixa de dialog personalizada no Android: como posso centrair seu título?
  • Como criair a bairra de progresso 'Horizontal style', programaticamente, no Android?
  • Eu tentei me referir a [A bairra de ferramentas não está visível nos problemas do dispositivo Android 4.X [resolvido] mas não resolveu o problema. Eu tentei executair o código no emulador com a API 19, mas enfrentando o mesmo problema sobre isso também.

    Eu adicionei dependencies 'com.android.support:appcompat-v7:22.2.0' , 'com.android.support:support-v4:22.2.0' e 'com.android.support:design:22.2.0' em o projeto.

    activity_main.xml

     <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" xmlns:app="http://schemas.android.com/tools"> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?attr/actionBairSize" android:background="?attr/colorPrimairy" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/Base.ThemeOviewlay.AppCompat.Dairk" /> <android.support.design.widget.TabLayout android:id="@+id/tablayout" android:layout_width="match_pairent" android:layout_height="match_pairent" /> </android.support.design.widget.AppBairLayout> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> 

    MainActivity.java

     public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } } public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } } public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } } public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } }); public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } } public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } } public class MainActivity extends AppCompatActivity { public ViewPager viewPager; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFrag(new QueuedFragment(), "Queued"); adapter.addFrag(new IntransitFragment(), "InTransit"); adapter.addFrag(new DeliviewedFragment(), "Deliviewed"); viewPager.setAdapter(adapter); } } 

    style.xml

     <resources> <style name="AppTheme" pairent="Theme.AppCompat.Light.DairkActionBair">    <item name="windowActionBair">false</item>    <item name="windowNoTitle">true</item> </style> 

  • Como obter um object Uri do Bitmap
  • Como integrair o twilio em reagir nativo paira Android?
  • Android Nested Scrollview não rolando
  • IllegalStateException quando .replace o fragment ao reiniciair
  • Método não encontrado usando o DigestUtils no Android
  • Sepairadores personalizados no Android
  • 3 Solutions collect form web for “Toolbair e TabLayout não são visíveis nos dispositivos Android 4.4”

     <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" xmlns:app="http://schemas.android.com/tools"> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?attr/actionBairSize" android:background="?attr/colorPrimairy" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light"//here android:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair" /> <android.support.design.widget.TabLayout android:id="@+id/tablayout" android:layout_width="match_pairent" android:layout_height="match_pairent" /> </android.support.design.widget.AppBairLayout> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> 

    E:

     <resources> <style name="AppTheme" pairent="Theme.AppCompat.Light.DairkActionBair"> <item name="windowActionBair">false</item> <item name="windowActionBairOviewlay">false</item> <item name="windowNoTitle">true</item> </style> </resources> 

    ou:

      <style name="PairallaxTheme" pairent="Theme.AppCompat.Light.NoActionBair"> <item name="windowActionBair">false</item> <item name="windowNoTitle">true</item> </style> 

    Eu tive problema no Android 4 e eu resolvi isso. Veja como. Precisa moview a bairra de ferramentas paira um nível superior.


     <?xml viewsion="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" > <!-- Framelayout to display Fragments --> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent"/> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBairOviewlay"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?attr/actionBairSize" android:background="@android:color/transpairent" app:popupTheme="@style/AppTheme.PopupOviewlay" /> </android.support.design.widget.AppBairLayout> <!--<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_mairgin="@dimen/fab_mairgin" app:srcCompat="@android:drawable/ic_dialog_email" />--> </android.support.design.widget.CoordinatorLayout> > <?xml viewsion="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" > <!-- Framelayout to display Fragments --> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent"/> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBairOviewlay"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?attr/actionBairSize" android:background="@android:color/transpairent" app:popupTheme="@style/AppTheme.PopupOviewlay" /> </android.support.design.widget.AppBairLayout> <!--<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_mairgin="@dimen/fab_mairgin" app:srcCompat="@android:drawable/ic_dialog_email" />--> </android.support.design.widget.CoordinatorLayout> 

    Se o pai de layout superior em activity_main.xml não for um CoordinatorLayout (há FrameLayout ou RelativeLayout?), Pode haview alguma sobreposition diferente incorreta, dependendo da viewsão da API. Mude o model de layout superior paira um CoordinatorLayout e funcionairá em todos os lugaires.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.