![](/img/trans.png)
[英]Align Bitmap Image inside ImageView - CS50 Pokedex Android
[英]Align ImageView inside WebView
我需要在 WebView 的右下角对齐图像,但图像总是在左上角。
我已经尝试使用本主题中的解决方案,但没有成功: 将 ImageView 与 LinearLayout 的右下角对齐。
有没有另一种方法可以做到这一点?
我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:id="@+id/imageBack"
android:layout_height="50dp"
android:layout_width="50dp"
android:src="@drawable/logo_mosaic"
/>
</WebView>
</LinearLayout>
您可以尝试以下代码来实现-
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</WebView>
<ImageView android:id="@+id/imageBack"
android:layout_height="50dp"
android:layout_gravity="bottom|right"
android:layout_width="50dp"
android:src="@drawable/logo_mosaic"
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.