關於android開發在布局中使用sharp時遇到的問題

來源:互聯網
上載者:User

最近學習使用android中的sharp元素,其中的corners屬性令我甚是費解,在此記錄下問題解決心得,以便查閱!

 

從網上找到一篇講解sharp的文章,自認為寫的非常詳細  http://kofi1122.blog.51cto.com/2815761/521605, 觀察其中sharp的corners節點的使用方法如下代碼引用,照著嘗試去做,結果令我很是困惑。

 

<corners 
                android:topRightRadius="5dp"
                android:bottomLeftRadius="5dp"
                android:topLeftRadius="0dp"
                android:bottomRightRadius="0dp"
/>

 

在android2.1的環境中使用如上代碼,完全沒有圓角,只有加上android:radius="5dp"才會出現圓角(不知道是不是android2.1的問題)。

其中 android:topLeftRadius="0dp"  和 android:bottomRightRadius="0dp"

是罪魁禍首, 不知道筆者為什麼會寫成0還貼出了, 查了很多資料才知道, 這個值不能設0 ,設為1dp後, 所有圓角效果就出現了。

 

鬱悶的就是為什麼設0不起作用呢, 如果想做部分直角,部分圓角效果根本無法完成, 有個辦法是將1dp設成1px就可以以假亂真了,不要設1dp(設1dp圓角還是很明顯的),不知道這算不算android系統的bug... 

 

<corners 
                android:topRightRadius="5dp"
                android:bottomLeftRadius="5dp"
                android:topLeftRadius="1px"
                android:bottomRightRadius="1px"
/>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.