画像を追加して表示するタイトルバーをカスタマイズすると、画像がエッジに正確に固定されないため、問題が発生します。私はウィンドウマージンとイメージの間のスペースを見ることができるイメージを添付しました。この問題を解決する方法。以下は、タイトルバーをカスタマイズするために使用したコードです。誰も私がこの問題を解決するのを助けることができます。カスタムタイトルバー(アンドロイド)の問題
Javaコード:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.home_view);
this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.upwindow);
レイアウトコード:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="32dp">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/up_bar"
android:src="@drawable/up_bar" />
<TextView
android:id="@+id/pagename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Sify MyStorage"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>