最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to create a rounded corner button with an image? - Android - Stack Overflow

programmeradmin0浏览0评论

I want to create a button which has rounded corners and uses a wood texture as its style, something similar to this

I have tried with ImageButtons, LayerLists and nothing has worked so far. The current implementation that doesn't break everything is this piece of code, where the '@drawable/wood' is the texture file.

<FrameLayout
            android:layout_width="0dp"
            android:layout_height="80dp"
            android:layout_margin="16dp"
            android:layout_rowWeight="1"
            android:layout_columnWeight="1">

            <ImageButton
                android:id="@+id/button25"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/wood"
                android:contentDescription="25€"
                android:scaleType="centerCrop" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="25€"
                android:textColor="@android:color/white"
                android:textSize="150sp"
                android:textStyle="bold" />
        </FrameLayout>
发布评论

评论列表(0)

  1. 暂无评论