【发布时间】:2015-12-20 07:14:15
【问题描述】:
我想实现的如图所示,详情页副标题显示为“+91创建”
目前我只能实现标题。 这是我用于创建标题的代码我也需要创建子标题知道吗??
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:emojicon="http://schemas.android.com/tools"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/linearLayout"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax" >
<ImageView
android:id="@+id/event_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_launcher"
android:transitionName="event_image"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/img_event"
android:background="@drawable/gradient_black" >
</FrameLayout>
</RelativeLayout>
<include
android:id="@+id/tool_bar"
layout="@layout/tool_bar" />
</android.support.design.widget.CollapsingToolbarLayout>
【问题讨论】:
-
你试过getSupportActionBar().setSubtitle(""); ?
-
@Shahzeb 是的,我有,根据开发者博客,我们只能通过 collapsingToolbar.setTitle("title");我问的是,有没有其他方法来设置字幕? android-developers.blogspot.in/2015/05/…
标签: android android-layout material-design