<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scaleScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
>
<LinearLayout
android:id="@+id/scaleLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scaleX="2"
android:scaleY="2"
android:focusable="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="https://bbs.csdn.net/topics/@mipmap/p1" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="https://bbs.csdn.net/topics/@mipmap/p2" />
</LinearLayout>
</ScrollView>

運行效果如圖,我的目的是想放大后,讓兩張圖片能夠滾動可以查看全完整的圖片。但是放大后,大部分都被遮住了。垂直滾動的時候,有一半都看不見了,也滾動不了。請問大神如何設定才能讓滾動條隨著布局放大而放大呢?剛開始接觸移動端,新手不太熟,望指教。
uj5u.com熱心網友回復:
頂一下,請問有人知道嗎?uj5u.com熱心網友回復:
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scaleScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
>
<LinearLayout
android:id="@+id/scaleLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="https://bbs.csdn.net/topics/@mipmap/p1" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="https://bbs.csdn.net/topics/@mipmap/p2" />
</LinearLayout>
</ScrollView>
修改兩個地方:1.把“ android:scaleX="2"
android:scaleY="2" ”刪掉
2.把 imageview的android:scaleType改成"centerCrop"
uj5u.com熱心網友回復:
android:scaleX="2"android:scaleY="2" 我這樣寫的目的就是為了放大布局,就像閱讀器一樣,當圖片的字看不清楚時,可以放大查看。但是放大之后,ScrollView不會跟著放大。也就是沒法滾動查看完整了。有什么辦法讓滾動也可以查看完整圖片呢。
uj5u.com熱心網友回復:
android:scaleX="2"
android:scaleY="2" 我這樣寫的目的就是為了放大布局,就像閱讀器一樣,當圖片的字看不清楚時,可以放大查看。但是放大之后,ScrollView不會跟著放大。也就是沒法滾動查看完整了。有什么辦法讓滾動也可以查看完整圖片呢
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/224611.html
標籤:Android
上一篇:剛做了一個軟體分享給大家
