无法在Android actionbar中更改图像宽度和高度
这是我的代码:无法在Android actionbar中更改图像宽度和高度,android,android-layout,Android,Android Layout,这是我的代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="?attr/listPreferredItemHeight" xmlns:tools="http://sch
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeight"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/contact_background"
android:orientation="horizontal"
android:paddingEnd="@dimen/activity_padding"
android:gravity="center_vertical">
<ImageSwitcher
android:id="@+id/icon_switcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginEnd="5dp">
<ImageView
android:layout_width="28sp"
android:layout_height="28sp"
app:srcCompat="@drawable/ic_person_circle"/>
<ImageView
android:id="@+id/selected"
android:layout_width="28sp"
android:layout_height="28sp"
app:srcCompat="@drawable/ic_selected"/>
</ImageSwitcher>
<TextView
android:id="@android:id/text1"
android:textAppearance="@style/contactListTextPrimary"
android:layout_toEndOf="@id/icon_switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:paddingEnd="16sp"
android:layout_alignParentTop="true"
android:maxLines="1"
tools:text="Contact title"/>
<TextView
android:id="@android:id/text2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_toEndOf="@id/icon_switcher"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:ellipsize="end"
android:maxLines="1"
android:maxWidth="240sp"
android:layout_below="@android:id/text1"
tools:text="Dolorem ipsum quia dolor sit amet consectetur adipisci velit"/>
</RelativeLayout>
什么都不管用。在手机中,头像图像始终占据所有高度。在您的
图像切换器中添加填充物,例如android:padding=“4dp”
Mouaad,我已经尝试过了,但没有任何效果
android:adjustViewBounds="true"