0
我正在使用Android設計庫組件,並且我想要在我的ToolBar
和TabLayout
後面有一個圖像。圖片必須裁剪並且不適合尺寸。我實際上將我的圖像設置爲android:background="@drawable/AppBarBg"
,AppBarLayout
,這不會裁剪(當然)我的圖像。我如何裁剪我的背景圖片?設計庫Android
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
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="100dp"
android:background="@drawable/AppBarBg"
android:scaleType="centerCrop"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/ToolBarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:orientation="horizontal"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
感謝我其實這種嘗試,但首先我不想崩潰任何東西,它通過顏色換成我的形象不同的屬性玩。 我會嘗試更多 – Wninou