2021 3 5 知识点总结

重新开发体温上报app所总计的新知识:

1、悬浮按钮。悬浮按钮需要其他依赖:

  如下:

    implementation 'com.google.android.material:material:1.0.0'

  使用:

  

 <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/add"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="32dp"
        android:layout_marginBottom="87dp"
        android:clickable="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="1.0"
        app:srcCompat="@android:drawable/ic_input_add" />

 2、navigation容器,是谷歌2018发布的新容器,能更加方便地管理fragment,需要依赖:

  

  implementation 'androidx.navigation:navigation-fragment:2.0.0'
    implementation 'androidx.navigation:navigation-ui:2.0.0'

使用时在res中新建navigation目录新建相应文件即可,

3、在fragment中的上下文对象可以用getActivity(),在fragment中使用百度地图API,SQLite数据库会有很多细节问题,

4、SQLite读取的数据存在Cursor中,要使用必须先movefirst,因为下标从-1开始,会报错

5、使用ScrollView滑动视图时,要注意改容器里只能有一个子对象,可以用布局管理器全部包裹

6、设置组件到布局管理器的距离,可以用android:layout_marginLeft="30dp"之类的

7、要画表格的话可以用表格布局管理器,总体设置背景颜色,表格设置不一样的颜色,然后设置padding就行。

8、遇到问题应该兴奋,慢慢调试,那样又能掌握一些很多人不知道细节知识点,

原文地址:https://www.cnblogs.com/fuxw4971/p/14488409.html