2017-10-08 172 views
-1

我正在使用Android Studio 2.3.3並創建應用程序。我已經作出了使用約束佈局的註冊頁面,如下所示:在Android Studio中增加ImageView的大小

Layout

這是我想看看在所有設備上,但是,在我的萬普拉斯2佈局進行測試時變成:

Layout

正如你在我的設備上看到的,最後一個EditText和Button之間有一堆空白。

圖片查看XML屬性

android:id="@+id/imageProfile" 
    android:layout_width="match_parent" 
    android:layout_height="150dp" 
    android:layout_marginBottom="8dp" 
    android:layout_marginEnd="16dp" 
    android:layout_marginLeft="16dp" 
    android:layout_marginRight="16dp" 
    android:layout_marginStart="16dp" 
    android:layout_marginTop="8dp" 
    android:adjustViewBounds="false" 
    android:cropToPadding="false" 
    android:src="@mipmap/ic_launcher" 
    app:civ_border_color="#FF000000" 
    app:civ_border_width="2dp" 
    app:layout_constraintBottom_toTopOf="@+id/btnRegister" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toBottomOf="@+id/txtPasswordConfirm" 
    app:layout_constraintVertical_bias="0.5" 

我的ImageView被設定爲一組高度可能是原因,但我怎麼得到它調整杉更大的屏幕?

文件夾結構

image

我如何去有關解決此問題?任何幫助表示讚賞。 在此先感謝。

+0

它總是更好的來發表您的完整代碼。別擔心,沒有人會偷走它! – mrid

+1

只是想簡潔哈哈 –

回答

1

像這樣:

android:layout_width="0dp" 
android:layout_height="0dp" 
android:adjustViewBounds="true" 
android:scaleType="fitCenter" 
+0

完美,謝謝。 –