第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

Button實(shí)現(xiàn)一遍直角一邊半圓和Button之間無(wú)距離

標(biāo)簽:
Android

1.Button之间无距离:当我们在xml中写两个Button的时候他们的实际距离是8dp;想让我们的Button之间无距离的话只要把距离设置为-8dp即可:android:layout_marginLeft="-8dp"

2.Button实现左边半圆右边直角或者右边半圆左边直角:

实现左边半圆右边直角的:国控

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- 填充的颜色:这里设置为红色 -->
    <solid android:color="#FF0000"/>
    <!-- 设置按钮的四个角为弧形   android:radius 弧形的半径 -->
    <corners android:bottomLeftRadius="10dp"
            android:topLeftRadius="10dp"
            android:bottomRightRadius="0dp"
            android:topRightRadius="0dp"/>
</shape>

实现中间的无直角:省控

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- 填充的颜色:这里设置为红色 -->
    <solid android:color="#FF0000"/>
</shape>

实现右边的左边直角右边圆角:小型站

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- 填充的颜色:这里设置为红色 -->
    <solid android:color="#FF0000"/>
    <!-- 设置按钮的四个角为弧形   android:radius 弧形的半径 -->
    <corners android:bottomLeftRadius="0dp"
             android:topLeftRadius="0dp"
             android:topRightRadius="10dp"
             android:bottomRightRadius="10dp"/>
</shape>

选择器里面的状态在代码中已经介绍,在这里不再介绍,把xml中的整体效果展示一下:


<LinearLayout
    android:id="@+id/ll_top"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:layout_margin="10dp"
    android:orientation="horizontal">

    <Button
        android:id="@+id/tv_country"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:text="国控"
        android:background="@drawable/horn_fragment_site"
        android:textSize="25sp"/>

    <Button
        android:id="@+id/tv_province"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:text="省控"
        android:background="@drawable/horn_fragment_site_mid"
        android:layout_marginLeft="-8dp"
        android:textSize="25sp"/>

    <Button
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:text="小型站"
        android:layout_marginLeft="-8dp"
        android:background="@drawable/horn_fragment_right"
        android:textSize="25sp"/>

</LinearLayout>

如果你想在代码中实现点击换颜色的话,你需要再写3中选择器,不过写的代码是同上的,这里不再介绍;只需要在监听的时候改变其他两个的状态即可!

原文链接:http://www.apkbus.com/blog-784586-62773.html

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫(xiě)下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶(hù)
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專(zhuān)欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消