【发布时间】:2019-05-24 15:14:58
【问题描述】:
我有以下布局,我需要使用 FrameLayout 将最喜欢的图像放置在 itemImage 的右上角
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetails"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="20dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/itemdimage"
android:layout_width="match_parent"
android:layout_height="300dp"
android:scaleType="fitEnd"
tools:srcCompat="@mipmap/ic_launcher"
/>
<ImageView
android:id="@+id/favorite"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="end"
android:layout_margin="10dp"
tools:srcCompat="@mipmap/ic_launcher_round"
android:elevation="10dp"/>
</FrameLayout>
但最喜欢的图像永远不会显示??我的布局有什么问题
任何帮助将不胜感激
【问题讨论】:
-
布局对我来说似乎没问题,图像在我的 Android Studio 的右上角。也许问题出在您以编程方式更改图像时。
-
@RomainGoutte-Fangeas 我在活动代码中没有任何改变!