【问题标题】:How to create transparent rounded button in android? [duplicate]如何在android中创建透明的圆形按钮? [复制]
【发布时间】:2016-03-16 17:12:56
【问题描述】:

我想创建按钮登录并像这样注册

.

【问题讨论】:

标签: android android-layout android-button


【解决方案1】:

在您的布局中包含 button.xml 并通过给它一个 id 将其用作按钮,或者您也可以将边框设置为按钮以获得相同的结果

按钮.xml

 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/border">

        <TextView android:id="@+id/skillTextView"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Cleaner"
              android:textSize="@dimen/abc_text_size_medium_material"
              android:textColor="@color/text_grey"
              android:layout_margin="@dimen/normal_margin"
              android:layout_centerInParent="true"
    />
    </RelativeLayout>

drawable/border.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <corners
            android:radius="5dp"
            />
    <stroke
            android:width="1dp"
            android:color="@color/white" />
</shape>

【讨论】:

  • 它工作正常,感谢您的回答!
猜你喜欢
  • 2016-08-14
  • 2019-12-24
  • 2018-06-17
  • 2013-04-18
  • 2014-12-26
  • 2020-02-20
  • 2014-03-27
  • 2014-10-10
  • 1970-01-01
相关资源
最近更新 更多