Android Design Note

来源:互联网 发布:淘宝买学生证搜什么 编辑:程序博客网 时间:2024/06/06 04:08

关于android app设计的一些笔记。


-Tabs are most appropriate for small sets (4 or fewer) of section-related screens. 

tab最适合4组或4组以下的分区内容

-Tab switches should not be treated as history. For example, if a user switches from a tab Ato another tab B, pressing the Back button (more on that in the next lesson) should not re-select tab A

tab切换不应该记录历史操作(点击back不应该回到上个tab)

-tabs should always run along the top of the screen, and should not be aligned to the bottom of the screen.tab应该在屏幕顶部。而不是底部。

Use primarily one type of button per container. Only mix button types when you have a good reason to, such as emphasizing an important function.每个container中使用一种主要的button类型(Float, Raised, Flat Button ),除非你有足够好的理由去混用button(比如需要强调某个button的功能)。

-you can declare the logical parent of each activity by specifying theandroid:parentActivityName attribute in the <activity> element.

通过在manifest文件中,指定activity的"android: parentActivityName"属性来指定其逻辑上的父Activity。(以实现向上)


-新版本的 Design Support Library(23.1.0)现在AppBarLayout里面包含了一个新的layout_scrollFlag :SCROLL_FLAG_SNAP。在滚动结束后,如果view只是部分可见,它将滑动到最近的边界。比如,如果view的底部只有25%可见,它将滚动离开屏幕,而如果底部有75%可见,它将滚动到完全显示。这意味着如果你实现自己的behaviour或者与AppbarLayout有关的东西,滚动不会在处于中间状态的时候停止。方法很简单:在AppbarLayout的子控件里加上app:layout_scrollFlags="scroll|exitUntilCollapsed|snap

-添加MD转场动画的特效,ActivityOptionsCompat.makeSceneTrasitionAnimation的第二个参数是shareView也就是自然过渡的那个公用的view。第三个参数是这个view的String类型的name。

Intent intent = new Intent(MainActivity.this, ViewerActivity.class);intent.putExtra("index", position);ActivityOptionsCompat options = ActivityOptionsCompat        .makeSceneTransitionAnimation(this, itemView, adapter.get(position).url);startActivity(intent, options.toBundle());

-toolbar的两个theme,终于搞清楚区别了:

android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"<!--设置Dark表示actionBar的文字颜色为黑色-->app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/><!--设置Light主题使得toolbar的overflow menu变成白色风格-->
使用
<item name="windowActionModeOverlay">true</item>
来使文本复制时,ActionMode覆盖toolbar。【注意,加android: 前缀会使windowActionModeOverlay属性无效(用的是toolbar)】

0 0