直播电商平台开发,Android | 图片缩放、自动居中

直播电商平台开发,Android | 图片缩放、自动居中

1、activity_main.xml

 


<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center" >
 
    <ImageView
        android:id="@+id/photo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:scaleType="matrix" >
    </ImageView>
 
</FrameLayout>

2、部分 AndroidManifest.xml

 


    <uses-permission android:name="android.permission.INTERNET" />
 
    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.PhotoDemo"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

 

        【注意】添加 INTERNET 权限

 


    <uses-permission android:name="android.permission.INTERNET" />

 

以上就是直播电商平台开发,Android | 图片缩放、自动居中, 更多内容欢迎关注之后的文章

 

posted @ 2023-04-12 14:10  云豹科技-苏凌霄  阅读(17)  评论(0编辑  收藏  举报