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

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

Android ScrollView 疑問

Android ScrollView 疑問

婷婷同學_ 2019-01-05 22:13:32
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@color/colorAccent">     <TextView         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_gravity="center"         android:background="@color/colorPrimaryDark"         android:text="測試一下測試一下測試一下測試一下測試一下測試一下測試一下測試一下測試一下測試一下測試一下"         android:textSize="70sp" /></ScrollView>
查看完整描述

1 回答

?
Helenr

TA貢獻1780條經驗 獲得超4個贊

scrollview實際寬高在代碼中~=(約等于)屏幕寬高,驗證方法,可以在Activity中輸出scrollview的高度 實際是約等于屏幕高度,而不是內容高度

然后它還有content寬高,這個寬高是根據內容的大小決定。
android:layout_gravity="center"是讓TextView的中心對齊scrollview的中心,并不能對齊scrollview的content中心

如果想實現對齊content中心 建議在TextView外層包裹一個LinearLayout或者其他ViewGroup


查看完整回答
反對 回復 2019-01-05
  • 1 回答
  • 0 關注
  • 485 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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