• 两种数据加载动画


    android 数据加载动画:

        <FrameLayout
            android:layout_centerInParent="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
    
            <RelativeLayout
                android:id="@+id/rl_loading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
    
                <ProgressBar
                    android:layout_centerInParent="true"
                    android:id="@+id/pb"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
    
                <TextView
                    android:layout_marginTop="30dp"
                    android:layout_below="@+id/pb"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="加载数据中....." />
    
              
            </RelativeLayout>
        </FrameLayout>
        
          <ListView
                    android:id="@+id/lv_black"
                    android:layout_below="@+id/rl1"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" >
                </ListView>
    

    代码的方式:

    public class TreasureActivity extends Activity implements OnClickListener {
    
    	private TextView money, integral, bill;
    	private LinearLayout addBankCard, transfer, myBankCard, tixian,
    	creditCard/* ,taojin */;
    	private ExecutorService fixedThreadPool;
    	private Bitmap userImg;// 用户头像
    	private String yue, allIntegral;
    	private Button setting,topay;
    	private PreferencesHelper ph;
    	private ProgressDialog dialog;
    	
    
    	@Override
    	protected void onCreate(Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    		setContentView(R.layout.treasure_activity_layout);
    		// 注册默认的未捕捉异常处理类
    		Thread.setDefaultUncaughtExceptionHandler(AppException
    				.getAppExceptionHandler());
    		AppManager.getAppManager().addActivity(this);
    		// 创建一个定长线程池,可控制线程最大并发数,超出的线程会在队列中等待:
    		fixedThreadPool = Executors.newFixedThreadPool(3);
    		// Toast.makeText(getApplicationContext(), Constant.portrait, 0).show();
    		ph = new PreferencesHelper(getApplicationContext(), Constants.ANZIDate);
    		initView();
    
    	}
    
    	@Override
    	protected void onResume() {
    		// TODO Auto-generated method stub
    		super.onResume();
    		getMoney();
    		getUserData();
    	}
    
    
    	/*
    	 * 联网获取用户数据
    	 */
    	private void getUserData() {
    		// 获得用户头像
    		if ("null".equals(ph.getValue("portrait"))) {// 用户头像为空
    			// userIc.setImageResource(R.drawable.icon_head);
    		} else {
    			// 获得线程消息
    			final Handler handler = new Handler() {
    				@Override
    				public void handleMessage(Message msg) {
    					String s = (String) msg.obj;
    					if ("ok".equals(s)) {
    						integral.setText(allIntegral);
    						dialog.dismiss();
    					} else if ("no".equals(s)) {
    						Toast.makeText(getApplicationContext(), "系统问题", 1)
    						.show();
    						dialog.dismiss();
    					}
    				}
    			};
    			dialog = ProgressDialog.show(this, null, "正在加载……请稍后", true, true);
    			dialog.setCanceledOnTouchOutside(false);
    			fixedThreadPool.execute(new Runnable() {
    				@Override
    				public void run() {
    					// TODO Auto-generated method stub
    					try {
    						String result = Net.yue(Constant.netcard
    								+ "/checkpoints.shtml", "uid",
    								ph.getValue("uid"));
    						// 解析json字符串
    						result = result.substring(1, result.length() - 1);
    						Log.i("查询结果", result);
    						JSONObject jsonObject = new JSONObject(result);
    						allIntegral = jsonObject.getString("message");
    						// 通知UI
    						Message msg = new Message();
    						msg.obj = "ok";
    						handler.sendMessage(msg);
    					} catch (Exception e) {
    						e.printStackTrace();
    						// 通知UI
    						Message msg = new Message();
    						msg.obj = "no";
    						handler.sendMessage(msg);
    					}
    				}
    			});
    		}
    	}
    
  • 相关阅读:
    Microsoft Visual Studio 2008
    JavaScript动态添加|绑定事件
    超级实的js代码大全 [转]
    《dojo 边学边用》(02), djConfig配置解说
    整合ckeditor_3.0.1和ckfinder_aspnet_1.4.1.1,配置随笔记录
    everybody is a tourist。you and me。
    测试并提升你的jQuery选择器水平
    php
    《dojo 边学边用》(01), 初识dojo,dojo简介和框架概览
    HTML 三栏自动适应
  • 原文地址:https://www.cnblogs.com/childhooding/p/4516108.html
Copyright © 2020-2023  润新知