在基本活動中,我試圖將圖像附加到工具欄。在ImageView部分android:layout_height="217dp"
中的這段代碼中。我不想這樣說,因爲我最近讀到的算法適用於所有設備。所以我最終的選擇是使用:match_parent
或wrap_content
。如果我使用217dp
,我的應用程序將看起來不同。但是,如果我使用match_parent
或wrap_content
作爲圖像視圖,我會得到一個巨大的工具欄,它佔用了幾乎一半的屏幕。我該怎麼辦?工具欄中的圖像:佈局:高度
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:background="@color/colorWagner">
<ImageView
android:layout_width="wrap_content"
android:layout_height="217dp"
app:srcCompat="@drawable/wagner"
android:layout_gravity="left"
android:id="@+id/imageView" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_first"
android:layout_height= "wrap_content" />
你能提供一個你想要的工具欄的圖像嗎? – lmiguelvargasf
@Imiguelvargasf - 我添加了一張圖片。不要介意DOT ......它在圖像本身。 –
我同意@RahulAgrawal,你可以減少圖像的大小,並應用''wrap_content'',或者你可以像我在我提供的答案中一樣嘗試使用百分比。 – lmiguelvargasf