亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何修復 Xamarin.Android 中的圖像縮放?

如何修復 Xamarin.Android 中的圖像縮放?

C#
梵蒂岡之花 2023-07-22 16:48:27
我正在開發一個顯示一些圖像的應用程序。但是當我顯示 ImageView 時,它會擴展父線性布局。我怎樣才能解決這個問題?<ScrollView    android:layout_height="wrap_content"    android:layout_width="match_parent">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="match_parent"        android:orientation="vertical">        <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:background="@drawable/linearlayoutround"            android:layout_marginLeft="3dp"            android:layout_marginRight="3dp"            android:layout_marginTop="2dp"            android:layout_marginBottom="10dp"            android:orientation="vertical">            <RelativeLayout                android:layout_width="match_parent"                android:layout_height="match_parent" >                <de.hdodenhof.circleimageview.CircleImageView                    android:layout_width="32dp"                    android:layout_height="32dp"                    android:layout_margin="5dp"                    android:src="@drawable/testimage" />                <TextView                    android:layout_width="match_parent"                    android:layout_height="32dp"                    android:textColor="@color/White"                    android:layout_marginTop="5dp"                    android:layout_marginLeft="44dp"                    android:textSize="24dp"                    android:text="Admin" />            </RelativeLayout>            <ImageView                android:id="@+id/testtest"                android:layout_width="match_parent"                android:layout_height="match_parent"                android:layout_gravity="center"                android:layout_marginRight="1dp"                android:layout_marginLeft="1dp"                android:src="@drawable/testimage"/>        </LinearLayout>    </LinearLayout></ScrollView>我要這個:但顯示這個:
查看完整描述

1 回答

?
天涯盡頭無女友

TA貢獻1831條經驗 獲得超9個贊

嘗試使用android:adjustViewBounds屬性


將其添加到ImageView中,如下所示:


<ImageView

      android:id="@+id/testtest"

      android:layout_width="match_parent"

      android:layout_height="match_parent"

      android:layout_gravity="center"

      android:layout_marginRight="1dp"

      android:layout_marginLeft="1dp"

      android:adjustViewBounds="true"

      android:src="@drawable/testimage"/>  


查看完整回答
反對 回復 2023-07-22
  • 1 回答
  • 0 關注
  • 169 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號