6

Güncelleme: bu Android 5.0 olur ama 5.1 üzerinde gayet güzel çalışıyor. Ben bu sorunu (https://code.google.com/p/android/issues/detail?id=175240) dosyalanmış ve yapacaklarını CollapsingToolbarLayout düzgün çalışmıyor


yüzden yeni Design Support Library ile oynuyorum kütüphanenin sonraki sürümünde yer alması ve ben bazı sorunları çalıştırmak gibi görünüyor. Ben çoğu çözdüm ama bu işe alınamıyor. Aslında, hatta provided example telefonumda düzgün çalışıyor değil.

sorun araç çubuğu genişletildiğinde, simgeler yol çok yüksek olmasıdır. Ve çökünce, onlar basitçe gitti. Ekran görüntülerine bakın.

Bir Moto X 5.0 çalıştıran bu çalışıyorum. Bunu daha cihazlarda olur biliyor, ama aslında bazıları üzerinde çalışır. bu sana mı oluyor? Bilinen bir çözüm var mı? and they are gone here

+0

çalışacağız "kaydırma exitUntilCollapsed" herhangi bir yardım. – Psypher

+0

@Ranjith "Resmi" repoya (https://github.com/chrisbanes/cheesesquare/) bir bağlantı bıraktım çünkü bu örnek çalışmıyor ya da – aows

+0

bu kodu denedim ... Bu kod benim için mükemmel çalıştı .... – Psypher

cevap

1

arrow and contextual menu are almost out of the screen Bu fenomen android 5.0 olacak ve

yukarıda Bu çözmek için benim yolum bulundu: delete "android: fitsSystemWindows =" android.support.design içinde "" gerçek .widget.CoordinatorLayout. Bunun gibi

:

com.android.support:design:22.2.0 olduğu bilinen bir hata var
<?xml version="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:id="@+id/main_content" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/detail_backdrop_height" 
    android:fitsSystemWindows="true" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 
+1

kaldırma fitsSystemWindows = "true", araç çubuğu yerleşimini doğru olarak alır, ancak görünümünüzün statusbar'a ulaşmasını engelleyebilirsiniz. – Patrick

+0

Şimdi buldum. Bu android 5.0 üzerinde bir hata olduğunu düşünüyorum. Ben goog fikri degilim.sorry –

+0

Android 5.0 veya bu kütüphanede bir hata olup olmadiini bilmiyorum, ama 5.0 üzerinde çalisiyor ve 5.1 üzerinde çalisiyor. – aows

1

Ben programlı araç çubuğu marjı ayarlamak ve araç çubuğu android set kullanarak düzeltin. CheeseDetailActivity üzerinde

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/detail_backdrop_height" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:fitsSystemWindows="true"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:expandedTitleMarginStart="48dp" 
      app:expandedTitleMarginEnd="64dp"> 

      <ImageView 
       android:id="@+id/backdrop" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scaleType="centerCrop" 
       android:fitsSystemWindows="true" 
       app:layout_collapseMode="parallax" /> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
       android:fitsSystemWindows="true" 
       app:layout_collapseMode="pin" /> 

     </android.support.design.widget.CollapsingToolbarLayout> 

    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:paddingTop="24dp"> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="@dimen/card_margin"> 

       <LinearLayout 
        style="@style/Widget.CardContent" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="Info" 
         android:textAppearance="@style/TextAppearance.AppCompat.Title" /> 

        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="@string/cheese_ipsum" /> 

       </LinearLayout> 

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

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="@dimen/card_margin" 
       android:layout_marginLeft="@dimen/card_margin" 
       android:layout_marginRight="@dimen/card_margin"> 

       <LinearLayout 
        style="@style/Widget.CardContent" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="Friends" 
         android:textAppearance="@style/TextAppearance.AppCompat.Title" /> 

        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="@string/cheese_ipsum" /> 

       </LinearLayout> 

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

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="@dimen/card_margin" 
       android:layout_marginLeft="@dimen/card_margin" 
       android:layout_marginRight="@dimen/card_margin"> 

       <LinearLayout 
        style="@style/Widget.CardContent" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="Related" 
         android:textAppearance="@style/TextAppearance.AppCompat.Title" /> 

        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="@string/cheese_ipsum" /> 

       </LinearLayout> 

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

     </LinearLayout> 

    </android.support.v4.widget.NestedScrollView> 

    <android.support.design.widget.FloatingActionButton 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     app:layout_anchor="@id/appbar" 
     app:layout_anchorGravity="bottom|right|end" 
     android:src="@drawable/ic_discuss" 
     android:layout_margin="@dimen/fab_margin" 
     android:clickable="true"/> 

</android.support.design.widget.CoordinatorLayout> 

:

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_detail); 

    Intent intent = getIntent(); 
    final String cheeseName = intent.getStringExtra(EXTRA_NAME); 

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    TypedValue tv = new TypedValue(); 
    if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { 
     int actionBarHeight = (int) (TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()) 
       - (getResources().getDimension(R.dimen.abc_action_bar_default_padding_material))*2); 
     FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) toolbar.getLayoutParams(); 
     layoutParams.topMargin = - (actionBarHeight/2); 
     toolbar.setLayoutParams(layoutParams); 
    } 
    setSupportActionBar(toolbar); 
    getSupportActionBar().setDisplayHomeAsUpEnabled(true); 

    CollapsingToolbarLayout collapsingToolbar = 
      (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); 
    collapsingToolbar.setTitle(cheeseName); 

    loadBackdrop(); 
} 

Sonuçlar: activity_detail.xml düzeni üzerinde

http://s22.postimg.org/nnwi0mh41/initial.png http://s22.postimg.org/8cmp00js1/collapsed.png

4

com.android.support:design:22.2.1 
01 Sabit
-2

kaldır android:

+0

Tek satırlı bir yanıt yerine biraz açıklama yapmanızı tavsiye ederim. –

0

collapsingToolBar düzeni için bu satırı ekleyin = "true" fitsSystemWindows: app: layout_scrollFlags = | Sen için bazı kodlar göndermek gerekebilir

o