1. 程式人生 > >安卓仿qq狀態獲取

安卓仿qq狀態獲取

public void changMyFriendStatus(String userID, UserStatus status) {
    for (GGUser ou : this.MyFriendUserInfo) {
        if (ou.getUserID().equals(userID)) {
            ou.setUserStatus(status);

            synchronized (friendStatusChangeds) {
                for (FriendStatusChangedListener listener : friendStatusChangeds) {
                    listener.FriendStatusChanged(userID, status);
                }
            }
            break;
        }
    }
}

 

 

  • android Imageview中圖片變成灰色的方法
  • public class AndroidUI {
        /**
         *
         *  // 將ImageView變成灰色
         * @param imageView
         */
        public static void ToGrayImage(ImageView imageView) {
    
            ColorMatrix matrix = new ColorMatrix();
            matrix.setSaturation(0);//飽和度 0灰色 100過度彩色,50正常
            ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
            imageView.setColorFilter(filter);
        }
    }

使用ImageButton,設定的時候不要使用BACKGROUPRESOURCE,否則變灰不能生效,同樣跟IMAGEVIEW一樣是使用

setImageResource,效果OK
<ImageButton 
    android:id="@+id/ct_photo"
    android:layout_height="52dip"
    android:layout_width="52dip"
    android:layout_margin="5dip"
    />