第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

Flowlayout和Scrollview共存的問題

如題~加入項目后,在flowlayout外面套一層ScrollLayout就會顯示不出來~求解答。。。

正在回答

2 回答

你好,我在視頻中的布局文件外層添加了ScrollView,一切正常呀~

測試布局文件如下:

<ScrollView?xmlns:android="http://schemas.android.com/apk/res/android"
????xmlns:tools="http://schemas.android.com/tools"?
????android:layout_width="match_parent"
????android:layout_height="match_parent">

????<RelativeLayout
????????android:layout_width="match_parent"
????????android:layout_height="wrap_content"?>

????????<com.imooc.view.FlowLayout
????????????android:id="@+id/id_flowlayout"
????????????android:layout_width="fill_parent"
????????????android:layout_height="wrap_content"
????????????android:background="#E5E5F5"
????????????android:padding="20dp"?>
????????</com.imooc.view.FlowLayout>
????</RelativeLayout>

</ScrollView>


0 回復 有任何疑惑可以回復我~
#1

weirdguy

我最近遇到一個問題,使用ScrollView嵌套ListView ListviewView里的item包含F(xiàn)lowLayout的布局 因為需要計算Listview中item的高度 但是在計算測量的時候 因為FlowLayout要多次測量才能得到準確的值 所有每次計算時都出現(xiàn)計算的高度超過實際高度 導致ScrollView布局底部多出一大部分的空白 希望老師能指點下怎么解決?
2016-03-17 回復 有任何疑惑可以回復我~
#2

慕粉18604581180

請問解決了嗎,我的是ListView 的View中包含F(xiàn)lowLayout,數(shù)據(jù)出現(xiàn)混亂 ,求解啊
2016-10-14 回復 有任何疑惑可以回復我~
//你可能這樣寫:
setMeasuredDimension(
????modeWidth?==?MeasureSpec.AT_MOST???width?+?getPaddingLeft()?+?getPaddingRight()?:?sizeWidth,
????modeHeight?==?MeasureSpec.AT_MOST???height?+?getPaddingTop()+?getPaddingBottom()?:?sizeHeight
);
//用ScrollView的話modeHeight和sizeHeight取值永遠為0,0即不屬于AT_MOST也不屬于EXACTLY,而是屬于UNSPECIFIED
//所以第二個三目表達式最終選擇右邊的sizeHeight,而sizeHeight=0,把高度設置為0,肯定顯示不出來

//正確的寫法:
setMeasuredDimension(
????modeWidth?==?MeasureSpec.EXACTLY???sizeWidth?:?width?+?getPaddingLeft()?+?getPaddingRight(),
????modeHeight?==?MeasureSpec.EXACTLY???sizeHeight?:?height?+?getPaddingTop()+?getPaddingBottom()
);
//因為modeHeight也不是EXACTLY,所以第二個三目表達式最終選擇右邊的height?+?getPaddingTop()+?getPaddingBottom(),這個是流式布局算好的值,所以可以顯示


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
打造Android中的流式布局和熱門標簽
  • 參與學習       30473    人
  • 解答問題       60    個

酷炫的熱門標簽到底是怎么實現(xiàn)的呢,本教程會給你答案

進入課程

Flowlayout和Scrollview共存的問題

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號