我正在尝试创建这样的东西
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/frameAdvertiseSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|snap">
<android.support.v4.view.ViewPager
android:id="@+id/viewPagerAdvertiseSlider"
android:layout_width="match_parent"
android:layout_height="@dimen/pager_advertise_slider_height"
android:layout_gravity="top" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicatorAdvertiseSlider"
style="@style/IntroPageIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/margin_medium" />
</FrameLayout>
<LinearLayout
android:id="@+id/linearLayoutMainCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_mini_small"
android:orientation="horizontal"
app:layout_scrollFlags="scroll|snap">
<Button
android:id="@+id/buttonMainCategory1"
style="@style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_category"
android:paddingBottom="12dp"
android:paddingTop="15dp"
android:text="@string/home_category_category" />
<Button
android:id="@+id/buttonMainCategory2"
style="@style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:drawablePadding="5dp"
android:drawableTop="@drawable/ic_action"
android:paddingTop="15dp"
android:text="@string/home_category_action" />
<Button
android:id="@+id/buttonMainCategory3"
style="@style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:drawablePadding="5dp"
android:drawableTop="@drawable/ic_new"
android:paddingTop="15dp"
android:text="@string/home_category_new" />
<Button
android:id="@+id/buttonMainCategory4"
style="@style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:drawablePadding="5dp"
android:drawableTop="@drawable/ic_most_selling"
android:paddingTop="5dp"
android:text="@string/home_category_most_selling" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayoutBanners"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_mini_small"
android:layout_marginTop="@dimen/margin_mini_small"
android:orientation="horizontal"
app:layout_scrollFlags="scroll|snap">
<ImageView
android:id="@+id/imageBanner1"
android:layout_width="0dp"
android:layout_height="@dimen/banner1_height"
android:layout_weight="1"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="@dimen/banner1_height"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/imageBanner2"
android:layout_width="match_parent"
android:layout_height="@dimen/banner2_height"
android:scaleType="fitXY" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#00000000" />
<ImageView
android:id="@+id/imageBanner3"
android:layout_width="match_parent"
android:layout_height="@dimen/banner2_height"
android:scaleType="fitXY" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|snap"
android:layout_marginBottom="@dimen/margin_mini_small">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayoutNews"
android:layout_width="match_parent"
android:layout_height="@dimen/tabs_height"
android:background="@color/white"
app:tabIndicatorColor="@color/main_color"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/home_tab_color"
app:tabTextColor="@color/home_tab_color" />
<android.support.v4.view.ViewPager
android:id="@+id/viewPagerNews"
android:layout_width="match_parent"
android:layout_height="@dimen/news_pager_height"/>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayoutPager"
android:layout_width="match_parent"
android:layout_height="@dimen/tabs_height"
android:background="@color/white"
app:tabGravity="center"
app:tabIndicatorColor="@color/main_color"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/home_tab_color"
app:tabTextColor="@color/home_tab_color" />
<android.support.v4.view.ViewPager
android:id="@+id/viewPagerTabs"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/home_profile_background" />
<LinearLayout
android:id="@+id/linearProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_medium"
android:orientation="vertical">
<rs.netlink.android.widgets.CircleImageView
android:id="@+id/circleImageViewProfile"
android:layout_width="@dimen/profile_image_size"
android:layout_height="@dimen/profile_image_size"
android:scaleType="centerCrop"
android:src="@drawable/default_profile_image"
app:border_color="@color/home_profile_image_ellipse"
app:border_width="1dp" />
<TextView
android:id="@+id/textName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small_medium"
android:textColor="@color/home_profile_image_ellipse"
android:textSize="@dimen/text_small_normal" />
<TextView
android:id="@+id/textEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_mini_small"
android:textColor="@color/home_profile_image_ellipse"
android:textSize="@dimen/text_micro_mini" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/margin_small">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
android:id="@+id/buttonMenuHome"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_menu_home"
android:drawableStart="@drawable/ic_menu_home"
android:text="@string/menu_home" />
<Button
android:id="@+id/buttonMenuProfile"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_menu_profile"
android:drawableStart="@drawable/ic_menu_profile"
android:text="@string/menu_profile" />
<Button
android:id="@+id/buttonMenuBasket"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_menu_basket"
android:drawableStart="@drawable/ic_menu_basket"
android:text="@string/menu_basket" />
<Button
android:id="@+id/buttonMenuWishList"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_menu_wish_list"
android:drawableStart="@drawable/ic_menu_wish_list"
android:text="@string/menu_wish_list" />
<Button
android:id="@+id/buttonMenuWhereToBay"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_where_to_bay"
android:drawableStart="@drawable/ic_where_to_bay"
android:text="@string/menu_where_to_buy" />
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/home_menu_separator_line" />
<Button
android:id="@+id/buttonMenuSettings"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_menu_settings"
android:drawableStart="@drawable/ic_menu_settings"
android:text="@string/menu_settings" />
<Button
android:id="@+id/buttonMenuCallCenter"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_call_center"
android:drawableStart="@drawable/ic_call_center"
android:text="@string/menu_call_centar" />
<Button
android:id="@+id/buttonMenuAboutUs"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_about_us"
android:drawableStart="@drawable/ic_about_us"
android:text="@string/menu_about_us" />
<Button
android:id="@+id/buttonMenuTerms"
style="@style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_terms"
android:drawableStart="@drawable/ic_terms"
android:text="@string/menu_terms" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.design.widget.NavigationView>
当我在AppBarLayout中尝试此内容时,会显示屏幕高度是多少。当我设置DrawerLayout android:layout_height="wrap_content"
时,它不起作用。如何解决这个问题。
感谢。
答案 0 :(得分:0)
您希望在包含工具栏之后使用结束标记AppBarLayout
,而不是在线性布局之后的结束标记function fact(n) {
if (n == 1)
return 1;
if (n < 1)
return 0;
return n * fact(n - 1);
}
。你拥有它的方式包括你在myPow
而不是在它下面定义的大部分内容,这不是我认为你试图做的。