[针对每个项目的编辑按钮的材料设计建议

问题描述 投票:2回答:2

我想为项目列表中的每个按钮添加一个编辑按钮。每个视图只能使用一次Android操作按钮,因此这些按钮没有任何意义。遵循材料准则还有其他方法吗?此按钮应该是可以飞行并且可以飞行的东西,具体取决于是否按下了整个编辑按钮。

android button
2个回答
0
投票

您应该使用扁平按钮,因为按钮会从背景弹出,容易引起注意并引导用户的视线。 Here是关于此的不错的帖子

更新:

要设计平面按钮效果,必须执行以下操作

  1. 定义按钮并将背景设置为可绘制对象,其中包含按下状态和默认状态的定义
  2. 对于按下状态,用纯色编写可绘制资源
  3. 对于状态默认值,编写一个可绘制对象,将指向按下状态的项目作为可绘制对象。并使用android:bottom =“ 2dp”
  4. 绘制更浅的形状作为另一个项目

flat_button.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true" android:drawable="@drawable/rect_pressed"/>
  <item android:drawable="@drawable/rect_normal"/>
</selector>

rect_normal.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:drawable="@drawable/rect_pressed" />

  <item android:bottom="@dimen/layer_padding">
      <shape android:shape="rectangle">
          <corners android:radius="@dimen/corner_radius" />
          <solid android:color="@color/blue_normal" />
      </shape>
  </item>
</layer-list>

rect_pressed.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
  <corners android:radius="@dimen/corner_radius" />
  <solid android:color="@color/blue_pressed" />
</shape>

如果您需要阅读完整的教程go here


0
投票

您可能应该使用flat or raised button(取决于您的编辑功能的重要性)。

© www.soinside.com 2019 - 2024. All rights reserved.