رفتن به مطلب
انجمن اندروید ایران | آموزش برنامه نویسی اندروید و موبایل
  • android.png.1fab383bc8500cd93127cebc65b1dcab.png

اشکال در اضافه کردن collapsingToolbarLayout


پست های پیشنهاد شده

سلام و خسته نباشید

من توی برنامم وقتی از collapsingToolbarLayout استفاده می کنم موقع اجرا دیگه تب ها و محتویات ویو پیجرم رو نشون نمیده...

در واقع وقتی تگ اصلی( RelativeLayout ) رو به CoordinatotLayout تغییر میدم تب لیوت و ویوپیجر نمایش داده نمیشند

و وقتی از تگ collapsingToolbarLayout استفاده می کنم فورس کلوز میده برنامه:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.narsis.countriesandcontinents.mainPage.MainActivity">


    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <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"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp"
            android:fitsSystemWindows="true">

        <com.antonioleiva.materializeyourapp.SquareImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            android:fitsSystemWindows="true"
            app:layout_collapseMode="parallax"/>


        <include
            layout="@layout/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true">

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

        <android.support.design.widget.TabLayout
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:id="@+id/tablayout"
            app:tabGravity="fill"
            app:tabMode="fixed"
            android:background="@color/colorPind_primary"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:tabTextAppearance="@style/myTabStyle"
            app:tabBackground="@color/colorPind_primary">
        </android.support.design.widget.TabLayout>

        <android.support.v4.view.ViewPager
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/viewpager">
        </android.support.v4.view.ViewPager>
    </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>

کدهای جاوا: (قسمت های مرتبط در کلاس Main)

import android.support.design.widget.CollapsingToolbarLayout;
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
  public CollapsingToolbarLayout collapsingToolbarLayout=null;

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.navigation);
        collapsingToolbarLayout= (CollapsingToolbarLayout) findViewById(R.id.tablayout);
    }
}

ممنون میشم راهنمایی کنید...

لینک ارسال
به اشتراک گذاری در سایت های دیگر

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...