最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android 實(shí)現(xiàn)帶角標(biāo)的ImageView(微博,QQ消息提示)

 更新時(shí)間:2018年01月17日 11:07:53   作者:Si-Kang  
下面小編就為大家分享一篇Android 實(shí)現(xiàn)帶角標(biāo)的ImageView(微博,QQ消息提示),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

角標(biāo)繪制過(guò)程:用畫(huà)筆量出一個(gè)字符的寬度作為角標(biāo)背景的半徑(R),然后判斷傳入字符串的總長(zhǎng)度

如果只有一位字符:那么就以 R 為半徑,畫(huà)一個(gè)圓,然后在圓中寫(xiě)上數(shù)字

如果有兩位以上的字符,就不能單純用一個(gè)圓了,用畫(huà)筆測(cè)量字符串的完整長(zhǎng)度( len ),然后在右上角畫(huà)一個(gè)圓,在這個(gè)圓的圓心左邊 len 長(zhǎng)度的位置 作為圓心再畫(huà)一個(gè)圓,最后以這個(gè)兩個(gè)圓的上下頂點(diǎn)(一共四個(gè))構(gòu)成一個(gè)矩形,進(jìn)行填充

源碼地址:https://github.com/SiKang123/AndroidToolBox

效果如下:

集成方法

在Project的 build.gradle 下添加

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

在Module的 build.gradle 下添加

dependencies {
    compile 'com.github.SiKang123:AndroidToolBox:1.0'
}

使用方法

圖片中的效果,Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:gravity="center_horizontal"
  android:orientation="vertical"
  android:paddingTop="50dp">

  <android.simple.toolbox.widget.CornerImageView
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_margin="20dp"
    android:src="@mipmap/ic_launcher"
    app:cornerBackground="@color/red"
    app:cornerText="9"
    app:cornerTextColor="@color/white"
    app:cornerTextSize="11dp" />

  <android.simple.toolbox.widget.CornerImageView
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_margin="20dp"
    android:src="@mipmap/ic_launcher"
    app:cornerBackground="@color/red"
    app:cornerText="99"
    app:cornerTextColor="@color/white"
    app:cornerTextSize="11dp" />

  <android.simple.toolbox.widget.CornerImageView
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_margin="20dp"
    android:src="@mipmap/ic_launcher"
    app:cornerBackground="@color/red"
    app:cornerText="999"
    app:cornerTextColor="@color/white"
    app:cornerTextSize="11dp" />

  <android.simple.toolbox.widget.CornerImageView
    android:id="@+id/progress_imageview"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_margin="20dp"
    android:src="@mipmap/ic_launcher"
    app:cornerBackground="@mipmap/shanchu"
    app:cornerLoadColor="@color/alpha_black_35"
    app:cornerRadius="7dp" />
</LinearLayout>

Activtiy:

@Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cornerimage);
    //設(shè)置最后一個(gè)圖片的加載進(jìn)度為20%,并添加點(diǎn)擊事件
    CornerImageView imageView = (CornerImageView) findViewById(R.id.progress_imageview);
    imageView.progress(20);
    imageView.setOnCornerClickListener(new CornerImageView.OnCornerClickListener() {
      @Override
      public void onCornerClickListener(View view) {
        Toast.makeText(SimpleCornerImageActivity.this, "角標(biāo)被點(diǎn)擊", Toast.LENGTH_SHORT).show();
      }
    });
  }

以上這篇Android 實(shí)現(xiàn)帶角標(biāo)的ImageView(微博,QQ消息提示)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android編程中Perferences的用法實(shí)例分析

    Android編程中Perferences的用法實(shí)例分析

    這篇文章主要介紹了Android編程中Perferences的用法,以實(shí)例形式較為詳細(xì)的分析了配置文件preferences.xml的功能、定義及使用方法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-11-11
  • Android Fragment多層嵌套重影問(wèn)題的解決方法

    Android Fragment多層嵌套重影問(wèn)題的解決方法

    這篇文章主要介紹了Android Fragment多層嵌套重影問(wèn)題的解決方法,從解決bug的思想,導(dǎo)致原因,原理解析等方面找出問(wèn)題所在原因,最終解決方法就可以簡(jiǎn)單了,對(duì)fragment 多層嵌套問(wèn)題感興趣的朋友一起通過(guò)本文學(xué)習(xí)吧
    2016-08-08
  • 5種Android數(shù)據(jù)存儲(chǔ)方式匯總

    5種Android數(shù)據(jù)存儲(chǔ)方式匯總

    這篇文章主要為大家整理了5種Android數(shù)據(jù)存儲(chǔ)方式,列出了各存儲(chǔ)方式的優(yōu)缺點(diǎn),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • Android自定義輪播圖效果

    Android自定義輪播圖效果

    這篇文章主要為大家詳細(xì)介紹了Android自定義輪播圖效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • android設(shè)備不識(shí)別awk命令 缺少busybox怎么辦

    android設(shè)備不識(shí)別awk命令 缺少busybox怎么辦

    這篇文章主要為大家詳細(xì)介紹了android設(shè)備不識(shí)別awk命令,缺少busybox的解決方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • Android開(kāi)發(fā)之自定義CheckBox

    Android開(kāi)發(fā)之自定義CheckBox

    本文通過(guò)實(shí)例代碼演示如何在Android中如何自定義CheckBox,實(shí)現(xiàn)的效果很好,有需要的可以參考借鑒。
    2016-08-08
  • Android中利用zxing實(shí)現(xiàn)自己的二維碼掃描識(shí)別詳解

    Android中利用zxing實(shí)現(xiàn)自己的二維碼掃描識(shí)別詳解

    這篇文章主要給大家介紹了關(guān)于Android中利用zxing實(shí)現(xiàn)自己的二維碼掃描識(shí)別的相關(guān)資料,文中通過(guò)圖文介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用zxing具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起看看吧。
    2017-09-09
  • Android提高之BLE開(kāi)發(fā)Android手機(jī)搜索iBeacon基站

    Android提高之BLE開(kāi)發(fā)Android手機(jī)搜索iBeacon基站

    這篇文章主要介紹了BLE開(kāi)發(fā)Android手機(jī)搜索iBeacon基站,需要的朋友可以參考下
    2014-08-08
  • android基礎(chǔ)教程之開(kāi)機(jī)啟動(dòng)示例

    android基礎(chǔ)教程之開(kāi)機(jī)啟動(dòng)示例

    這篇文章主要介紹了android開(kāi)機(jī)啟動(dòng)示例,開(kāi)機(jī)自動(dòng)啟動(dòng)程序后開(kāi)機(jī)啟動(dòng)廣播功能實(shí)現(xiàn),需要的朋友可以參考下
    2014-02-02
  • Android實(shí)現(xiàn)網(wǎng)頁(yè)圖片瀏覽功能

    Android實(shí)現(xiàn)網(wǎng)頁(yè)圖片瀏覽功能

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)網(wǎng)頁(yè)圖片瀏覽功能,輸入圖片的url然后點(diǎn)擊按鈕加載出來(lái)圖片,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-05-05

最新評(píng)論

闸北区| 博罗县| 佛山市| 班玛县| 临湘市| 双鸭山市| 武鸣县| 陈巴尔虎旗| 广平县| 图们市| 英德市| 栾川县| 华蓥市| 永济市| 庆阳市| 应城市| 溧阳市| 新营市| 双峰县| 上虞市| 府谷县| 平山县| 阳朔县| 巫溪县| 阿拉善左旗| 民权县| 青神县| 工布江达县| 迭部县| 健康| 丹阳市| 滨州市| 遂宁市| 雷州市| 潜江市| 宜兰市| 巨鹿县| 安岳县| 应用必备| 望都县| 衡东县|