Android 5.0 materyal tasarım stili navigasyon çekmece KitKat için
Android yeni navigasyon çekmece simgeler, çekmece simgesi ve geri ok simgesini tanıttı görüyorum. Nasıl Kitkat desteklenen uygulamalar içinde kullanabiliriz. En son navigasyon çekmece simgeler ve animasyonlar hangi Gazete bayisi uygulaması, Google'ın en son sürümüne bakın. Nasıl bu hale getirebiliriz?
19 minSDK ayarı denedim ve 21 complileSDK ama eski stil ikonları kullanıyor. Kendi kendine uygulanır?
CEVAP
Appcompat v21 ve bu kitaplığı ActionBarDrawerToggle
yeni araç Çubuğu olarak kullanmak gerekir.
Eğer gradle için gradle bağımlılık dosyası ekleyin:
compile 'com.android.support:appcompat-v7:21.0.0'
activity_main.xml
düzeni böyle bir şey görünecektir:
<!--I use android:fitsSystemWindows because I am changing the color of the statusbar as well-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@ id/main_parent_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar"/>
<android.support.v4.widget.DrawerLayout
android:id="@ id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Main layout -->
<FrameLayout
android:id="@ id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Nav drawer -->
<fragment
android:id="@ id/fragment_drawer"
android:name="com.example.packagename.DrawerFragment"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="left|start" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Araç Çubuğu düzeni böyle bir şey görünecektir:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@ id/toolbar"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
Senin etkinlikten genişletmek gerekir:
ActionBarActivity
Etkinlikte görüşleriniz (çekmece ve araç çubuğu) bulmak zaman destek eylem çubuğu olarak araç seti ve setDrawerListener ayarlayın:
setSupportActionBar(mToolbar);
mDrawerToggle= new ActionBarDrawerToggle(this, mDrawerLayout,mToolbar, R.string.app_name, R.string.app_name);
mDrawerLayout.setDrawerListener(mDrawerToggle);
Bundan sonra sadece menü öğeleri ve drawerToogle devlet bakımı için gereken:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = new MenuInflater(this);
inflater.inflate(R.menu.menu_main,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
public void onBackPressed() {
if(mDrawerLayout.isDrawerOpen(Gravity.START|Gravity.LEFT)){
mDrawerLayout.closeDrawers();
return;
}
super.onBackPressed();
}
Uygulama araç Çubuğunu önce olduğu gibi aynı ve ücretsiz ok animasyon alırsınız. Hayır baş ağrısı. Daha fazla bilgi için takip edin:
Eğer durum çubuğunun altında Araç ve çekmece görüntülemek istiyorsanız, lütfen 17* *bakın.
DÜZENLEME:Destek tasarım kitaplığından NavigationView kullanın. Burada nasıl kullanılacağını öğrenmek için öğretici: http://antonioleiva.com/navigation-view/
KitKat verir farklı Android Galeri Niy...
Android Navigasyon Çekmece görüntü ara...
Doğru kullanımı Android kullanıcısı Yö...
Bir şekilde Android üzerinde Python ça...
Benim ne olmalıdır .Android Studio pro...