【问题标题】:Is there a view for a button bar? (Image link describing the view)有按钮栏的视图吗? (描述视图的图片链接)
【发布时间】:2010-01-01 20:49:34
【问题描述】:

我正在寻找有关 Android 默认应用程序(例如电子邮件)或解锁模式中底部栏的视图或某种信息,如下图所示。我无法在 Androids 网站或 Google 搜索中找到任何关于此的信息。

图片:http://img11.imageshack.us/i/viewdn.jpg/

【问题讨论】:

标签: android


【解决方案1】:

我相信克里斯托弗是正确的;没有特殊的小部件可以在图像中创建栏。但是,如果您想模拟它,您可以创建一个布局并使用样式style="@android:style/ButtonBar"。这将为您提供浅灰色背景和正确的边距。

【讨论】:

  • 酷!以前没见过这种风格。然而,谷歌并没有费心在他们自己的应用程序中使用它(好吧,从我看过的几个布局来看)..
【解决方案2】:

我认为这些应用程序底部使用的按钮栏没有任何标准视图;通常只是将两个 Button 项目放在一个 LinearLayoutRelativeLayout 中。

例如,查看Android Open Source Project,您可以看到button bar for one of the email app setup screens 被定义为两个普通的旧Button 对象。

然而,令人惊讶的是,Google 没有将更多常见的东西抽象到 Android 主题或子布局中,而是在每个布局 XML 中拥有相同的视图和属性。

【讨论】:

    【解决方案3】:

    发件人:http://code.google.com/p/k9mail/source/browse/k9mail/trunk/res/layout/account_setup_basics.xml?r=1314

    <RelativeLayout
            android:layout_marginTop="-45dip" 
            android:padding="0dip"
            android:layout_alignParentBottom="true"
            android:gravity="bottom|right" 
            android:background="@android:drawable/bottom_bar"
            android:layout_height="fill_parent"
            android:layout_width="fill_parent">
            <Button
                android:id="@+id/manual_setup"
                android:text="@string/account_setup_basics_manual_setup_action"
                android:minWidth="@dimen/button_minWidth"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_marginBottom="-4dip" 
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="false" 
                />
            <Button
                android:id="@+id/next"
                android:text="@string/next_action"
                android:minWidth="@dimen/button_minWidth"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:drawableRight="@drawable/button_indicator_next"
                android:layout_marginBottom="-4dip" 
                android:layout_alignParentRight="true"
                android:layout_centerVertical="false" 
                />
        </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-03
      • 1970-01-01
      相关资源
      最近更新 更多