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

android中實(shí)現(xiàn)指針滑動(dòng)的動(dòng)態(tài)效果方法

 更新時(shí)間:2013年03月15日 10:27:12   作者:  
本次實(shí)現(xiàn)的是類似于墨跡天氣中軌跡圖片上指針隨著數(shù)值滾動(dòng)滑動(dòng)的效果,基本思路是開啟線程,控制指針?biāo)诘膇mageview控件的padding屬性。

復(fù)制代碼 代碼如下:

<FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#fff"
            android:paddingBottom="5dp"
            android:paddingLeft="5dp"
            android:paddingRight="2dp"
            >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:src="@drawable/up_icon"
                android:layout_marginTop="0dp"
                android:paddingTop="0dp" />

            <LinearLayout
                android:layout_width="240dip"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="7dp"
                android:orientation="horizontal" >

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:text="優(yōu)"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:text="良"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:text="中等"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:text="不健康"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:text="有毒害"
                    android:textSize="12sp" />
            </LinearLayout>

           
            <LinearLayout
                android:layout_width="240dip"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="7dp"
                android:layout_marginTop="40dp"
                android:orientation="horizontal" >

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_horizontal"
                    android:text="80"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_horizontal"
                    android:text="120"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_horizontal"
                    android:text="160"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_horizontal"
                    android:text="200"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_horizontal"
                    android:text="400"
                    android:textSize="12sp" />
            </LinearLayout>

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                android:src="@drawable/zhizhen"
                android:id="@+id/zhizhen"/>

            <ImageView
                android:id="@+id/dengji_img"
                android:layout_width="250dip"
                android:layout_height="wrap_content"
                android:layout_marginTop="25dp"
                android:src="@drawable/dengji_icon" />
        </FrameLayout>

上面這段代碼實(shí)現(xiàn)的布局為

首先,因?yàn)橹羔樣袎褐旅娴臐L動(dòng)條,因此這是一個(gè)framelayout的布局。其次,要實(shí)現(xiàn)指針的勻速滾動(dòng),需要開啟一個(gè)線程,在線程中能夠?qū)崿F(xiàn)利用循環(huán),以及線程的休眠,通過控制指針?biāo)趫D標(biāo)的padding屬性來實(shí)現(xiàn)滾動(dòng)的動(dòng)畫效果

復(fù)制代碼 代碼如下:

Handler myHandler =new Handler(){

        @Override
        public void handleMessage(Message msg) {
            // TODO Auto-generated method stub
            super.handleMessage(msg);
            //對(duì)于c的更改和循環(huán)應(yīng)該是在線程中跑,要不run僅僅執(zhí)行一次,           
            zhizhen.setPadding(c, 0, 0, 0);
        }

       
    };
    class MyThread extends Thread{

        @Override
        public void run() {
            //發(fā)送一個(gè)消息,通知主線程改變UI
         try {

             while(c<=input){
                 c=c+1;
                 this.sleep(10);
                 myHandler.sendEmptyMessage(0);                
             }

               
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

相關(guān)文章

  • Flutter使用socketIo實(shí)現(xiàn)實(shí)時(shí)通訊

    Flutter使用socketIo實(shí)現(xiàn)實(shí)時(shí)通訊

    本文主要介紹了Flutter使用socketIo實(shí)現(xiàn)實(shí)時(shí)通訊,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-07-07
  • Android編程實(shí)現(xiàn)的一鍵鎖屏程序詳解

    Android編程實(shí)現(xiàn)的一鍵鎖屏程序詳解

    這篇文章主要介紹了Android編程實(shí)現(xiàn)的一鍵鎖屏程序,結(jié)合實(shí)例形式詳細(xì)分析了Android一鍵鎖屏的原理與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2016-10-10
  • Android?ViewBinding使用介紹

    Android?ViewBinding使用介紹

    最近這段時(shí)間在學(xué)習(xí)Kotlin,突然發(fā)現(xiàn)谷歌已經(jīng)把kotlin-android-extensions插件廢棄,目前推薦使用ViewBinding來進(jìn)行替代,接下來通過本文給大家分享Android使用ViewBinding的詳細(xì)步驟,感興趣的朋友一起學(xué)習(xí)吧
    2022-09-09
  • android獲取聯(lián)系人示例分享

    android獲取聯(lián)系人示例分享

    這篇文章主要介紹了android獲取聯(lián)系人示例,需要的朋友可以參考下
    2014-02-02
  • Android 使用SwipeRefreshLayout控件仿抖音做的視頻下拉刷新效果

    Android 使用SwipeRefreshLayout控件仿抖音做的視頻下拉刷新效果

    這篇文章主要介紹了Android 使用SwipeRefreshLayout控件仿抖音做的視頻下拉刷新效果,需要的朋友可以參考下
    2018-05-05
  • Android studio導(dǎo)入項(xiàng)目的方法詳解(簡(jiǎn)單快速)

    Android studio導(dǎo)入項(xiàng)目的方法詳解(簡(jiǎn)單快速)

    最近開課移動(dòng)互聯(lián)網(wǎng)應(yīng)用開發(fā),實(shí)驗(yàn)課老師發(fā)了代碼讓我們導(dǎo)入,在網(wǎng)上找了各種方法,發(fā)現(xiàn)不是每一個(gè)項(xiàng)目都適合,有些能夠成功,有些還是有錯(cuò),頭大的很。后面發(fā)現(xiàn)一個(gè)比較簡(jiǎn)單的方法,沒翻過車,新手可以試試
    2017-06-06
  • Android 13新功能及適配工作詳解

    Android 13新功能及適配工作詳解

    這篇文章主要為大家介紹了Android 13的新功能及需要哪些適配工作詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03
  • Android 實(shí)現(xiàn)會(huì)旋轉(zhuǎn)的餅狀統(tǒng)計(jì)圖實(shí)例代碼

    Android 實(shí)現(xiàn)會(huì)旋轉(zhuǎn)的餅狀統(tǒng)計(jì)圖實(shí)例代碼

    這篇文章主要介紹了Android 實(shí)現(xiàn)會(huì)旋轉(zhuǎn)的餅狀統(tǒng)計(jì)圖實(shí)例代碼的相關(guān)資料,這里附有實(shí)例代碼及實(shí)現(xiàn)效果圖,需要的朋友可以參考下
    2016-12-12
  • Android開發(fā)中那些需要注意的坑

    Android開發(fā)中那些需要注意的坑

    這篇文章主要介紹了Android開發(fā)過程中那些需要注意的坑,有一些是自己遇到的,特分享給大家,需要的朋友可以參考下
    2016-04-04
  • android實(shí)現(xiàn)系統(tǒng)信息推送

    android實(shí)現(xiàn)系統(tǒng)信息推送

    這篇文章主要為大家詳細(xì)介紹了android實(shí)現(xiàn)系統(tǒng)信息推送,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-04-04

最新評(píng)論

舒城县| 黄冈市| 尚志市| 星座| 北海市| 禹州市| 德格县| 东乌珠穆沁旗| 石城县| 大庆市| 大厂| 宜昌市| 大洼县| 西乌| 沭阳县| 鲜城| 长丰县| 恩平市| 灌云县| 辽阳县| 岑巩县| 桂东县| 侯马市| 大竹县| 淮阳县| 玉树县| 宁乡县| 泽州县| 桂东县| 台南县| 遂平县| 蒲城县| 漠河县| 崇州市| 大同县| 东山县| 读书| 石狮市| 皮山县| 通辽市| 舞钢市|