如果图片的ImageView设为wrap_content,是可以居中的,但对于我是相册,需要设为fill_parent才能进行缩放。通过网上找资料,只要把组件放到一个LinearLayout下就可以了。

项目中的代码是:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout  xmlns:andro>
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center"
    android:layout_gravity="center"
     >
    <LinearLayout
        android:layout_width="fill_parent"
       android:layout_height="fill_parent" 
       android:orientation="vertical"
       android:gravity="center"
       android:layout_gravity="center">
         <ImageView
        android:id="@+id/pic"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="matrix"
        android:layout_gravity="center"
        android:gravity="center" />
        
    </LinearLayout>
   

    <ProgressBar
        android:id="@+id/progress"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" 
        />

</FrameLayout>

相关文章:

  • 2021-11-17
  • 2021-12-12
  • 2022-01-04
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2022-02-03
  • 2021-05-17
  • 2022-01-25
  • 2021-11-24
  • 2022-12-23
相关资源
相似解决方案