久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

android中TABS的圓角

Rounded corners for TABS in android(android中TABS的圓角)
本文介紹了android中TABS的圓角的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想為我在我的應用程序中構建的選項卡實現圓角.到目前為止,我能夠想出這個

I want to achieve rounded corners for the tab that I've constructed in my application. So far I was able to come up with this

我希望我的圓角看起來像這樣.(我的編碼方式是只出現左右角,但是當狀態改變時,它看起來像上圖)

I would like my rounded corners to look as so. (I've coded it in such a way that only the right and left corners appear but when the states change it looks like the above image)

以下是我目前編寫的代碼.如何通過代碼實現正確的圓角?

Below is the code that I've written so far. How can I achieve proper rounded corners through code ?

選定的 TAB.XML

SELECTED TAB.XML

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners
    android:topRightRadius="10dp"
    android:bottomLeftRadius="10dp"/>

<gradient
    android:startColor="#000" 
    android:endColor="#000"
    android:gradientRadius="400"
    android:angle="-270"/>

</shape>

未選擇的 TAB.XML

UNSELECTED TAB.XML

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<gradient 
android:angle="90" 
android:startColor="#880f0f10" 
android:centerColor="#8858585a" 
android:endColor="#88a9a9a9"/>

 <corners
    android:topLeftRadius="10dp"
    android:bottomRightRadius="10dp"/>

</shape>

感謝您的回復!:)

推薦答案

我認為你應該使用 4 個形狀:

I think you should use 4 shapes:

  • 左鍵未選中

  • for left button not selected

選擇左鍵

右鍵未選擇

選擇右鍵

然后編寫選擇器用于 button 背景,請參見左側按鈕的示例(右側類似):

And then write selector to use for button background, see example for the left button (for the right just the similar):

<selector
    xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_selected="true">
<shape android:shape="rectangle">
  <corners
    android:topLeftRadius="10dp"
    android:bottomLeftRadius="10dp"/>
  <gradient
    android:startColor="#000"
    android:endColor="#000"
    android:gradientRadius="400"
    android:angle="-270"/>
</shape>
</item>

<item>
    <shape android:shape="rectangle">
      <gradient
        android:angle="90"
        android:startColor="#880f0f10"
        android:centerColor="#8858585a"
        android:endColor="#88a9a9a9"/>
   <corners
      android:topLeftRadius="10dp"
      android:bottomLeftRadius="10dp"/>
</shape>
</item></selector>

這篇關于android中TABS的圓角的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 亚洲成人综合社区 | 九九伦理片 | www.youjizz.com日韩| www狠狠爱com| 亚洲欧美日韩成人在线 | 久久精品国产99国产 | 日韩在线免费 | 中文字幕欧美一区 | 国产日产久久高清欧美一区 | 农村真人裸体丰满少妇毛片 | 九色综合网 | 亚洲一区二区在线播放 | 精品天堂| 国内精品久久久久久 | 国产精品亚洲第一 | av网站免费观看 | 国产成人精品一区二区三区 | 欧美a在线 | 91亚洲一区| 国产乱码精品1区2区3区 | 欧美乱码精品一区二区三区 | www国产亚洲精品久久网站 | 草在线| 久久精品国产一区二区电影 | 久草视频观看 | 中文字字幕在线中文乱码范文 | 久久精品视频9 | 国产精品99免费视频 | 99视频免费 | 黄色成人在线网站 | 精品国产伦一区二区三区观看说明 | 一本色道精品久久一区二区三区 | 日本免费在线 | 97精品一区二区 | 日韩精品极品视频在线观看免费 | 人人操日日干 | www.中文字幕.com | 欧美中文字幕一区二区三区亚洲 | 日韩中文字幕在线播放 | 成人欧美一区二区三区白人 | 久久精品一二三影院 |