最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android如何實(shí)現(xiàn)底部菜單固定到底部

 更新時(shí)間:2020年09月22日 16:29:11   作者:手撕高達(dá)的村長  
這篇文章主要介紹了Android如何實(shí)現(xiàn)底部菜單固定到底部,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下

今天搞了很久的一個(gè)問題,導(dǎo)航菜單沒有固定到底部,因?yàn)樯厦媸荓istView,可是沒內(nèi)容,于是就浮動(dòng)上去了。

效果如下:

這里采用的是一個(gè)碎片,代碼是:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
  >

<TextView
  android:id="@+id/card_title_tv"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/background_card"
  android:gravity="center"
  android:textSize="18sp"/>

<ListView
  android:id="@+id/jonrney_list_item"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_marginBottom="48dp"
  />
</LinearLayout>

出問題了,百度了很多,試了很多的辦法,沒用。

主頁面代碼:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tl="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/container"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="#eeeeee"
  android:scrollbars="none"
  >

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <!--android:background="@color/colorPrimaryDark"-->
    <!--內(nèi)容-->
    <FrameLayout
      android:id="@+id/fl_change"
      android:layout_weight="1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      >
    </FrameLayout>
  <!-- <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/bottom"
    android:layout_alignParentBottom="true" >-->
<!--底部-->
    <com.flyco.tablayout.CommonTabLayout
      android:id="@+id/tl_3"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="#ffffff"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      tl:tl_indicator_gravity="TOP"
      tl:tl_indicator_color="#2C97DE"
      tl:tl_textSelectColor="#2C97DE"
      tl:tl_textUnselectColor="#66000000"
      tl:tl_underline_height="2dp"/>
  <!-- </LinearLayout>-->
    <!--android:layout_alignParentBottom="true"-->
  </LinearLayout>
</android.support.constraint.ConstraintLayout >

最后發(fā)現(xiàn)是這段代碼惹的麻煩:android:layout_height="wrap_content"

也是自己對這個(gè)屬性沒有了解清楚,不知道從哪里copy來的一個(gè)代碼,這個(gè)屬性代碼自動(dòng)浮動(dòng),根據(jù)內(nèi)容更改大小。所以就造成了我現(xiàn)在的情況。

所以改成:android:layout_height="match_parent" 就好了。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

常山县| 瑞丽市| 瑞昌市| 阳东县| 丰都县| 海门市| 柳州市| 木兰县| 政和县| 行唐县| 广饶县| 陕西省| 曲靖市| 阜阳市| 弥勒县| 刚察县| 青田县| 疏勒县| 肇州县| 平阴县| 政和县| 邢台市| 松阳县| 呼图壁县| 余庆县| 边坝县| 白朗县| 兴海县| 东兰县| 怀来县| 澄江县| 高州市| 宝鸡市| 鄂尔多斯市| 泾阳县| 菏泽市| 兰西县| 米易县| 井陉县| 平江县| 商洛市|