[英]Icon's size in Custom Layout Android
我想在“自定義標題”欄中更改應用程序圖標的大小。 到目前為止,這是我的代碼:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:background="#000000">
<ImageView
android:id="@+id/header"
android:src="@drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
</LinearLayout>
我的styles.xml文件是:
<style name="CustomWindowTitleBackground">
<item name="android:background">#00000000</item>
</style>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">30dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
這會在標題欄的左側生成一個圖標,但是如何更改圖標的大小呢? 我希望圖標更大一些。
也許您應該只為ImageView設置特定的DP屬性。 堅持使用DP,它將在所有設備上正常縮放。 像這樣:
<ImageView
android:id="@+id/header"
android:src="@drawable/ic_launcher"
android:layout_width="48dp"
android:layout_height="48dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.