【问题标题】:How to have display Android buttons in a user friendly way?如何以用户友好的方式显示 Android 按钮?
【发布时间】:2023-03-22 14:13:01
【问题描述】:

我有一个应用程序需要 不同的过滤器,这些过滤器是通过单击 按钮 实现的,现在我的屏幕空间不足,因为我还有 @987654322 @实现,应用的布局如下图所示:

正如所见,没有足够的空间来显示 15 个按钮,并不是说一起显示 15 个按钮看起来很奇怪,所以我怎样才能以用户友好的方式在屏幕上显示 15 个按钮(例如,ScrollDown for更多按钮),如果有人有一些示例代码,我将不胜感激。

对于想要查看布局的.xml 文件的人,这里是下面的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/black"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/filter_linear_layout"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/filter1_button"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:background="@drawable/button_white_red_transluscent"
        android:text="@string/filter1_text"
        android:textColor="@android:color/white" />

    <Button
        android:id="@+id/filter2_button"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:background="@drawable/button_white_red_transluscent"
        android:text="@string/filter2_text"
        android:textColor="@android:color/white" />

        ....and so on for the rest of the buttons

</LinearLayout>

<ImageView
    android:id="@+id/filter_image_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_toRightOf="@id/filter_linear_layout" />

【问题讨论】:

    标签: java android xml button layout


    【解决方案1】:

    您需要的是ScrollView。网上有很多例子。

    【讨论】:

      【解决方案2】:

      我建议您使用您选择的精美 ui 小部件,例如需要时隐藏,或提供带有菜单项而不是按钮的标志性侧边栏。看看Androidviews.com:

      功能区菜单:http://www.androidviews.net/2012/12/ribbonmenu/
      SwipeListView:http://www.androidviews.net/2013/03/swipelistview/

      【讨论】:

        猜你喜欢
        • 2017-08-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-16
        • 2011-04-24
        • 1970-01-01
        • 2012-09-24
        相关资源
        最近更新 更多