安卓懸停標(biāo)題欄

我是一個(gè)大二的學(xué)生蹬挺,然后被叫去參加什么比賽维贺,然后我看了一個(gè)APP的標(biāo)題欄懸停效果挺好看的,然后我 想我能不能實(shí)現(xiàn)巴帮,后來發(fā)現(xiàn)我做好以后有一點(diǎn)卡頓溯泣,滑動(dòng)阻尼太大,然后我因?yàn)檫@個(gè)耽擱了兩天時(shí)間榕茧,不知道是因?yàn)槭裁丛驅(qū)е碌睦伲乙舱伊撕芏嗑W(wǎng)上的教程,發(fā)現(xiàn)都是這種問題用押,然后我找到了掘金上面的解釋肢簿,CoordinatorLayout有bug,會(huì)導(dǎo)致阻尼太大蜻拨,出現(xiàn)卡頓效果池充,現(xiàn)在貼出代碼:

mainpage.xml代碼

?< ? xmlns:app="http://schemas.android.com/apk/res-auto"

? ? android:layout_width="match_parent"

? ? android:layout_height="match_parent"

? ? android:orientation="vertical">

? ? ? ? android:id="@+id/lmd_app_bar_layout"

? ? ? ? android:layout_width="match_parent"

? ? ? ? android:layout_height="wrap_content"

? ? ? ? app:elevation="0dp">

? ? ? ? ? ? android:id="@+id/lmd_toolbar"

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? app:contentInsetLeft="0dp"

? ? ? ? ? ? app:contentInsetStart="0dp"

? ? ? ? ? ? app:layout_scrollFlags="scroll|enterAlways"

? ? ? ? ? ? app:popupTheme="@style/ThemeOverlay.AppCompat.Light">


? ? ? ? ? ? android:id="@+id/lmd_tl_tablayout"

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="45dp"

? ? ? ? ? ? android:background="@android:color/white" />

? ? ? ? android:layout_width="match_parent"

? ? ? ? android:layout_height="match_parent"

? ? ? ? android:orientation="vertical"

? ? ? ? android:id="@+id/scrollView"

? ? ? ? app:layout_behavior="@string/appbar_scrolling_view_behavior">

? ? ? ? ? ? ? ? android:id="@+id/lmd_nsp_viewpager"

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="match_parent" />

include_mainpage代碼:


? ? xmlns:app="http://schemas.android.com/apk/res-auto"

? ? android:orientation="vertical"

? ? android:layout_width="match_parent"

? ? android:layout_height="match_parent">

? ? ? ? android:layout_width="match_parent"

? ? ? ? android:layout_height="wrap_content"

? ? ? ? android:orientation="vertical"

? >

? ? ? ? ? ? android:id="@+id/recycler"

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="150dp"

? ? ? ? ? ? app:autoPlaying="true"

? ? ? ? ? ? app:centerScale="1.4"

? ? ? ? ? ? app:itemSpace="20"

? ? ? ? ? ? app:moveSpeed="1.8"

? ? ? ? ? ? app:showIndicator="true" />

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? android:layout_below="@+id/recycler"

? ? ? ? ? ? android:background="@color/white"

? ? ? ? ? ? android:orientation="vertical"

? ? ? ? ? ? android:paddingBottom="8dp"

? ? ? ? ? ? android:paddingTop="5dp">

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? android:orientation="horizontal"

? ? ? ? ? ? ? ? android:weightSum="5">

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_1" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_2" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_3" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_4" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_5" />

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? android:layout_marginBottom="3dp"

? ? ? ? ? ? ? ? android:orientation="horizontal"

? ? ? ? ? ? ? ? android:weightSum="5">

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="學(xué)習(xí)用品" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="運(yùn)動(dòng)器材" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="電器" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="美妝" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="服飾" />

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? android:orientation="horizontal"

? ? ? ? ? ? ? ? android:weightSum="5">

? ? ? ? ? ? ? ? ? ? android:id="@+id/imageView"

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_6" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_7" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_8" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_9" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_margin="3dp"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:src="@mipmap/pic_10" />

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? android:orientation="horizontal"

? ? ? ? ? ? ? ? android:weightSum="5">

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="小百貨" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="游戲裝備" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="復(fù)習(xí)書本" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="電子設(shè)備" />

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? ? ? android:gravity="center"

? ? ? ? ? ? ? ? ? ? android:text="更多" />

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="10dp"

? ? ? ? ? ? android:background="#fafafa" />

最后我找到了解決辦法:

? ? ? ? ? app:layout_scrollFlags="scroll|enterAlways",問題出現(xiàn)在這里缎讼,設(shè)置標(biāo)志的問題收夸;

然后的問題還有CoordinatorLayout最好存在一個(gè)scrollview,scrollview里面存在一個(gè)子布局休涤,如果是rv咱圆,必須解決滑動(dòng)沖突

效果圖我不會(huì)加,動(dòng)態(tài)的功氨,希望見諒

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市手幢,隨后出現(xiàn)的幾起案子捷凄,更是在濱河造成了極大的恐慌,老刑警劉巖围来,帶你破解...
    沈念sama閱讀 218,607評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件跺涤,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡监透,警方通過查閱死者的電腦和手機(jī)桶错,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,239評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來胀蛮,“玉大人院刁,你說我怎么就攤上這事》嗬牵” “怎么了退腥?”我有些...
    開封第一講書人閱讀 164,960評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵任岸,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我狡刘,道長(zhǎng)享潜,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,750評(píng)論 1 294
  • 正文 為了忘掉前任嗅蔬,我火速辦了婚禮剑按,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘澜术。我一直安慰自己艺蝴,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,764評(píng)論 6 392
  • 文/花漫 我一把揭開白布瘪板。 她就那樣靜靜地躺著吴趴,像睡著了一般。 火紅的嫁衣襯著肌膚如雪侮攀。 梳的紋絲不亂的頭發(fā)上锣枝,一...
    開封第一講書人閱讀 51,604評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音兰英,去河邊找鬼撇叁。 笑死,一個(gè)胖子當(dāng)著我的面吹牛畦贸,可吹牛的內(nèi)容都是我干的陨闹。 我是一名探鬼主播,決...
    沈念sama閱讀 40,347評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼薄坏,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼趋厉!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起胶坠,我...
    開封第一講書人閱讀 39,253評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤君账,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后沈善,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體乡数,經(jīng)...
    沈念sama閱讀 45,702評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,893評(píng)論 3 336
  • 正文 我和宋清朗相戀三年闻牡,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了净赴。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,015評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡罩润,死狀恐怖玖翅,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤烧栋,帶...
    沈念sama閱讀 35,734評(píng)論 5 346
  • 正文 年R本政府宣布写妥,位于F島的核電站,受9級(jí)特大地震影響审姓,放射性物質(zhì)發(fā)生泄漏珍特。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,352評(píng)論 3 330
  • 文/蒙蒙 一魔吐、第九天 我趴在偏房一處隱蔽的房頂上張望扎筒。 院中可真熱鬧,春花似錦酬姆、人聲如沸嗜桌。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,934評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽骨宠。三九已至,卻和暖如春相满,著一層夾襖步出監(jiān)牢的瞬間层亿,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,052評(píng)論 1 270
  • 我被黑心中介騙來泰國打工立美, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留匿又,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,216評(píng)論 3 371
  • 正文 我出身青樓建蹄,卻偏偏與公主長(zhǎng)得像碌更,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子洞慎,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,969評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容