Code Fragment-UI组件的可定制化。

来源:互联网 发布:js实现div滑动效果 编辑:程序博客网 时间:2024/05/26 20:21

在Android Launcher里,有CellLayout的概念。在桌面上,文件夹里,以及Folder里都是使用了各自定制的CellLayout。它们的优点如下:

  1. 给用户很高的可定制性。
  2. 增加了代码的复用性。

可以定制的UI结构,以launcher:开头的为自定义的标签。

<com.android.launcher2.CellLayout    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"    style="@style/WorkspaceScreen"    android:paddingLeft="@dimen/workspace_left_padding"    android:paddingRight="@dimen/workspace_right_padding"    android:paddingTop="@dimen/workspace_top_padding"    android:paddingBottom="@dimen/workspace_bottom_padding"    android:hapticFeedbackEnabled="false"    launcher:cellWidth="@dimen/workspace_cell_width"    launcher:cellHeight="@dimen/workspace_cell_height"    launcher:widthGap="@dimen/workspace_width_gap"    launcher:heightGap="@dimen/workspace_height_gap"    launcher:maxGap="@dimen/workspace_max_gap" />