久久久久久久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(使用線程逐塊處理文件)
主站蜘蛛池模板: 精品日本久久久久久久久久 | 日韩免费一区 | 欧美日韩一区二区在线播放 | 精品av天堂毛片久久久借种 | 91精品久久久久久久久 | 久久久久国产一区二区三区四区 | 免费在线看黄 | 国产精品欧美大片 | 97视频在线免费 | 亚洲欧美日韩系列 | 国产精品一区在线 | 久久91精品 | 在线观看视频中文字幕 | 中文字幕一区二区三区精彩视频 | 欧美中文在线 | 中文字幕在线看人 | 99精品久久久久久中文字幕 | 一区二区三区视频免费看 | 亚洲综合天堂网 | 五月天婷婷激情 | 久久久久国产 | 日韩中文字幕在线视频观看 | 尤物在线精品视频 | 国产亚洲一区二区三区 | 成人免费观看男女羞羞视频 | 久久成人一区 | 欧美v在线观看 | 成人精品系列 | 欧美成年视频 | 亚洲视频二区 | 夜夜精品浪潮av一区二区三区 | 欧美电影免费观看高清 | 91精品国产综合久久久久久漫画 | 亚洲精品一区中文字幕乱码 | 国产精品嫩草影院精东 | 一级毛片成人免费看a | 97天天干 | 一区二区三区视频 | 91.色| 久久国产高清 | 日韩视频中文字幕 |