最贊回答 / 蘇大人V
根據在網上搜索的答案 已得到了解答無論是View還是ViewGroup對它們倆的調用順序都是onDraw()->dispatchDraw()?但在ViewGroup中,當它有背景的時候就會調用onDraw()方法,否則就會跳過onDraw()直接調用dispatchDraw();所以如果要在ViewGroup中繪圖時,往往是重寫dispatchDraw()方法?在View中,onDraw()和dispatchDraw()都會被調用的,所以我們無論把繪圖代碼放在onDraw()或者dispatchDr...
2018-08-17
最新回答 / MyBilly
setItemClickEvent()這一個方法里面,循環給layout下所有textview添加了setOnClickListener(),添加點擊事件了,自然就能點擊了
2018-07-29
接著最后一個tab不出現問題,對if的判斷改個順序即可對不同mTabVisibleCount的數量進行匹配
if (position>=(mTabVisibleCount-2)&&positionOffset>0
&&getChildCount()>mTabVisibleCount)
{ if (mTabVisibleCount!=1&&(position!=getChildCount()-2))
{}
if (mTabVisibleCount==1){ } }
if (position>=(mTabVisibleCount-2)&&positionOffset>0
&&getChildCount()>mTabVisibleCount)
{ if (mTabVisibleCount!=1&&(position!=getChildCount()-2))
{}
if (mTabVisibleCount==1){ } }
設置默認顯示個數的判斷應該是小于等于0 不然設置visible_tab_count="0"會有錯誤
if (mTabVisibleCount<=0){
mTabVisibleCount = COUNT_DEFAULT_TAB;
}
if (mTabVisibleCount<=0){
mTabVisibleCount = COUNT_DEFAULT_TAB;
}
最新回答 / 慕粉101344259
你看錯了吧,是layout_weigth=1。layout_weight就是按比例劃分,可以是別的數字,三個TextView都是1,那就三等分。
2018-04-21