簡體   English   中英

Android ImageView全屏

[英]Android ImageView Full Screen

我正在嘗試在ImageView上畫一個圓,到目前為止,我可以使用ImageView的位圖和setOnTouchListener來做到這一點,但它始終將其放置在錯誤的位置,所以我需要的是:使ImageView占據整個屏幕,使該點(0 ,0)匹配設備屏幕的點(0,0)。

我現在得到的結果

這是我的活動布局:

<RelativeLayout 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="wrap_content"
android:layout_height="wrap_content"
tools:context="com.example.ghoster.second.MainActivity" >

<ImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:srcCompat="@drawable/test4"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_marginRight="11dp"
    android:layout_marginEnd="11dp" />
</RelativeLayout>

用這個

android:scaletype="FIT_XY"

您也可以使用最新的API

android:scaletype="fitXY"

在圖像視圖中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM