本文介绍了Android的全宽ICS简约风格底ButtonsViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打一些按钮看起来像下面这样的:

I want to make some buttons that look like this the following:

我已经看了pretty很难在android.widget包preSET ICS的,但我找不到任何。我算起来也得是一个简单的方法,因为他们似乎是专题的整个操作系统版本。如果有人知道的一种方法,使按钮看起来像这些我会成为一个快乐的人。

I've looked pretty hard for preset ICS ones in the android.widget package, but I can't find any. I figure there's got to be an easy way, since they seem to be thematic of the entire OS version. If anyone knows of a way to make buttons look like these I'd be a happy camper.

推荐答案

在你正在寻找在Android ICS像在下面的截图按钮的XML布局的情况下,这里要说的是,我从Android的发现XML布局操作系统源$ C ​​$ C。

In case you are looking for the XML layout of the button from Android ICS like the one in the following screenshot, here is the XML layout that I found from Android OS source code.

<!-- Copyright (C) 2008 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- OK confirm and cancel buttons.  -->
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:divider="?android:attr/dividerHorizontal"
        android:showDividers="beginning"
        android:paddingTop="16dip">

    <LinearLayout
            style="?android:attr/buttonBarStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:measureWithLargestChild="true">

        <LinearLayout android:id="@+id/leftSpacer"
                android:layout_weight="0.25"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:visibility="gone" />

        <Button android:id="@+id/cancel_button"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_gravity="left"
                android:layout_weight="1"
                android:text="@string/cancel"
                android:maxLines="2"
                style="?android:attr/buttonBarButtonStyle" />

        <Button android:id="@+id/ok_button"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_weight="1"
                android:text="@string/install"
                android:maxLines="2"
                android:filterTouchesWhenObscured="true"
                style="?android:attr/buttonBarButtonStyle" />

        <LinearLayout android:id="@+id/rightSpacer"
                android:layout_width="0dip"
                android:layout_weight="0.25"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:visibility="gone" />

    </LinearLayout>
</LinearLayout>

这篇关于Android的全宽ICS简约风格底ButtonsViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 12:27