我的 Intent 是在一行中创建许多按钮,因此我认为每个按钮都必须很小。
如何创建这样的小按钮?
我尝试了下面的代码,但它并不相似。
这是我的style.xml
<style name="RightLink2" parent="@android:style/Widget.Button.Small">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:padding">2dip</item>
<item name="android:textSize">10dp</item>
</style>
这是我的layout.xml
<LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:orientation="horizontal" android:layout_height="wrap_content" android:weightSum="1">
<Button android:id="@+id/myButton"
style="@style/RightLink2"
android:text="Click here"/>
</LinearLayout>
最佳答案
如果你打算在一行中做很多小按钮,那你就错了。
在为手机编程时,您实际上是一名 UI 设计师。您必须记住,您的用户可能会在吃汉堡包和喝苏打水时使用他又肥又油腻的手指,并且仍然必须轻松地浏览您的应用程序。
有关于按钮的最小推荐尺寸的指南,但您应该使用以下想法:
- 如果你的线路上有 5 个以上的按钮,那你就错了
- 如果您仍想放置五个以上的按钮,您可以使用打开按钮 Pane / View 的五个按钮之一,或者水平滑动按钮线以显示其他按钮。
这两种方式都有效,但我更喜欢第二种,我觉得它更性感也更实用。您可能需要在侧面有一个小指示器(如三角形或等同物)以显示还有更多内容。可发现性很重要,如今用户接受了尝试滑动内容的培训。
关于android - 创建小按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7254812/