Drawable(5)关于从资源文件构造的Drawable不显示
要给它设置个bounds才可以
1 TextView noticeHeaderView; 2 TextView headerRefreshText; 3 ProgressBar headerRefreshPgrsb; 4 View headerRefresh; 5 Drawable d; 6 if (headerRefresh.getVisibility() == View.VISIBLE) { 7 ViewGroup.LayoutParams lp = headerRefresh.getLayoutParams(); 8 lp.height += y - startY; 9 if (lp.height >= noticeHeaderView.getHeight() * 2) { 10 headerRefreshText.setText("松手刷新"); 11 d = context.getResources().getDrawable(R.drawable.header_refresh_up); 12 }else{ 13 headerRefreshText.setText("下拉刷新"); 14 d = context.getResources().getDrawable(R.drawable.header_refresh_down); 15 } 16 Rect outRect = new Rect(); 17 headerRefreshPgrsb.getDrawingRect(outRect); 18 d.setBounds(outRect); 19 headerRefreshPgrsb.setIndeterminateDrawable(d); 20 }