Java Code Examples for android.widget.LinearLayout#invalidate()

The following examples show how to use android.widget.LinearLayout#invalidate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiListView.java    From WifiChat with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 添加下拉刷新的HeadView
 * 
 * @date 2015年2月14日 上午11:17
 * @change hillfly
 */
private void addHeadView() {
    mHeadView = (LinearLayout) mInflater.inflate(R.layout.listview_multilistview_head, null);

    mArrowImageView = (ImageView) mHeadView.findViewById(R.id.head_arrowImageView);
    mArrowImageView.setMinimumWidth(70);
    mArrowImageView.setMinimumHeight(50);
    mProgressBar = (ProgressBar) mHeadView.findViewById(R.id.head_progressBar);
    mTipsTextView = (TextView) mHeadView.findViewById(R.id.head_tipsTextView);
    mLastUpdatedTextView = (TextView) mHeadView.findViewById(R.id.head_lastUpdatedTextView);

    measureView(mHeadView);
    mHeadViewHeight = mHeadView.getMeasuredHeight();

    mHeadView.setPadding(0, -1 * mHeadViewHeight, 0, 0);
    mHeadView.invalidate();

    addHeaderView(mHeadView, null, false);

    mHeadState = DONE;
}
 
Example 2
Source File: BoardAdapter.java    From BoardView with Apache License 2.0 5 votes vote down vote up
public void removeItem(int column, int index){
    BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(column);
    ScrollView scrollView = (ScrollView)item.getChildAt(1);
    LinearLayout llColumn = (LinearLayout)scrollView.getChildAt(0);
    llColumn.removeViewAt(index);
    llColumn.invalidate();
    columns.get(column).objects.remove(index);
    columns.get(column).views.remove(index);
}
 
Example 3
Source File: BoardAdapter.java    From BoardView with Apache License 2.0 5 votes vote down vote up
public void addItem(int column,int index, Object item){
    BoardItem boardItem = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(column);
    TransitionManager.beginDelayedTransition(boardItem, transition);
    ScrollView scrollView = (ScrollView)boardItem.getChildAt(1);
    LinearLayout llColumn = (LinearLayout)scrollView.getChildAt(0);
    columns.get(column).objects.add(index,item);
    View v = createItemView(context,columns.get(column).header_object,item,column,index);
    llColumn.addView(v,index);
    boardView.addBoardItem(v,column);
    llColumn.invalidate();
    columns.get(column).views.add(index,v);
}
 
Example 4
Source File: LinearLayoutTestActivity.java    From AspectJDemo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_linear_layout_test);

  myLinearLayout = (LinearLayout) findViewById(R.id.linearLayoutOne);
  myLinearLayout.invalidate();
}
 
Example 5
Source File: CustomListView.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 添加下拉刷新的HeadView 
 * @date 2013-11-11 下午9:48:26
 * @change JohnWatson
 * @version 1.0
 */
private void addHeadView() {
	mHeadView = (LinearLayout) mInflater.inflate(R.layout.head, null);

	mArrowImageView = (ImageView) mHeadView
			.findViewById(R.id.head_arrowImageView);
	mArrowImageView.setMinimumWidth(70);
	mArrowImageView.setMinimumHeight(50);
	mProgressBar = (ProgressBar) mHeadView
			.findViewById(R.id.head_progressBar);
	mTipsTextView = (TextView) mHeadView.findViewById(
			R.id.head_tipsTextView);
	mLastUpdatedTextView = (TextView) mHeadView
			.findViewById(R.id.head_lastUpdatedTextView);

	measureView(mHeadView);
	mHeadViewHeight = mHeadView.getMeasuredHeight();
	mHeadViewWidth = mHeadView.getMeasuredWidth();
	
	mHeadView.setPadding(0, -1 * mHeadViewHeight, 0, 0);
	mHeadView.invalidate();

	Log.v("size", "width:" + mHeadViewWidth + " height:"
			+ mHeadViewHeight);

	addHeaderView(mHeadView, null, false);
	
	mHeadState = DONE;
}
 
Example 6
Source File: LinearLayoutTestActivity.java    From Android-AOPExample with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_linear_layout_test);

  myLinearLayout = (LinearLayout) findViewById(R.id.linearLayoutOne);
  myLinearLayout.invalidate();
}
 
Example 7
Source File: PullToRefreshListView.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
/***
 * 初始化头部
 */
private void initHeadView() {

	inflater = LayoutInflater.from(context);
	mHeadView = (LinearLayout) inflater.inflate(
			R.layout.pulldownlistview_head, null);

	mArrowImageView = (ImageView) mHeadView
			.findViewById(R.id.pulldownlistview_head_arrow_ImageView);
	mArrowImageView.setMinimumWidth(50);
	mArrowImageView.setMinimumHeight(50);
	mHeadProgressBar = (ProgressBar) mHeadView
			.findViewById(R.id.pulldownlistview_head_progressBar);
	mRefreshTextview = (TextView) mHeadView
			.findViewById(R.id.pulldownlistview_head_tips_TextView);
	mLastUpdateTextView = (TextView) mHeadView
			.findViewById(R.id.pulldownlistview_head_lastUpdated_TextView);

	headContentOriginalTopPadding = mHeadView.getPaddingTop();

	measureView(mHeadView);
	headContentHeight = mHeadView.getMeasuredHeight();
	headContentWidth = mHeadView.getMeasuredWidth();

	mHeadView.setPadding(mHeadView.getPaddingLeft(),
			-1 * headContentHeight, mHeadView.getPaddingRight(),
			mHeadView.getPaddingBottom());
	mHeadView.invalidate();

	// LOG.D("初始高度:"+headContentHeight);
	// LOG.D("初始TopPad:"+headContentOriginalTopPadding);

	addHeaderView(mHeadView);
	setOnScrollListener(this);
}
 
Example 8
Source File: QtActionBar.java    From imsdk-android with MIT License 4 votes vote down vote up
public void setPaddingTop(int height)
{
    LinearLayout linearLayout = (LinearLayout) this.findViewById(R.id.action_bar_layout);
    linearLayout.setPadding(getPaddingLeft(),height,getPaddingRight(),getPaddingBottom());
    linearLayout.invalidate();
}
 
Example 9
Source File: PullToRefreshListView.java    From wakao-app with MIT License 4 votes vote down vote up
private void init(Context context) {   
	//设置滑动效果
    animation = new RotateAnimation(0, -180,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);  
    animation.setInterpolator(new LinearInterpolator());  
    animation.setDuration(100);  
    animation.setFillAfter(true);  
  
    reverseAnimation = new RotateAnimation(-180, 0,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);  
    reverseAnimation.setInterpolator(new LinearInterpolator());  
    reverseAnimation.setDuration(100);  
    reverseAnimation.setFillAfter(true);  
    
    inflater = LayoutInflater.from(context);  
    headView = (LinearLayout) inflater.inflate(R.layout.pull_to_refresh_head, null);  
  
    arrowImageView = (ImageView) headView.findViewById(R.id.head_arrowImageView);  
    arrowImageView.setMinimumWidth(50);  
    arrowImageView.setMinimumHeight(50);  
    progressBar = (ProgressBar) headView.findViewById(R.id.head_progressBar);  
    tipsTextview = (TextView) headView.findViewById(R.id.head_tipsTextView);  
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.head_lastUpdatedTextView);  
    
    headContentOriginalTopPadding = headView.getPaddingTop();  
    
    measureView(headView);  
    headContentHeight = headView.getMeasuredHeight();  
    headContentWidth = headView.getMeasuredWidth(); 
    
    headView.setPadding(headView.getPaddingLeft(), -1 * headContentHeight, headView.getPaddingRight(), headView.getPaddingBottom());  
    headView.invalidate();  

    //System.out.println("初始高度:"+headContentHeight); 
    //System.out.println("初始TopPad:"+headContentOriginalTopPadding);
    
    addHeaderView(headView);        
    setOnScrollListener(this); 
}
 
Example 10
Source File: RMBTResultPagerAdapter.java    From open-rmbt with Apache License 2.0 4 votes vote down vote up
public void addResultListItem(String title, String value, LinearLayout  netLayout) {
	final float scale = activity.getResources().getDisplayMetrics().density;
    final int leftRightItem = Helperfunctions.dpToPx(5, scale);
    final int topBottomItem = Helperfunctions.dpToPx(5, scale);
    final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
    final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
    final int heightDiv = Helperfunctions.dpToPx(1, scale);        
    final int topBottomImg = Helperfunctions.dpToPx(1, scale);
    
    final LinearLayout netItemLayout = new LinearLayout(activity); 
    
    netItemLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem);
    
    netItemLayout.setGravity(Gravity.CENTER_VERTICAL);
    
    final TextView itemTitle = new TextView(activity, null, R.style.listResultItemTitle);
    itemTitle.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT, 0.4f));
    itemTitle.setWidth(0);
    itemTitle.setGravity(Gravity.LEFT);
    itemTitle.setText(title);
    
    netItemLayout.addView(itemTitle);
    
    final ImageView itemClassification = new ImageView(activity);
    itemClassification.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT, 0.1f));
    itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);
    
    itemClassification.setImageDrawable(activity.getResources().getDrawable(
            R.drawable.traffic_lights_none));
    netItemLayout.addView(itemClassification);
    
    final TextView itemValue = new TextView(activity, null, R.style.listResultItemValue);
    itemValue.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT, 0.5f));
    itemValue.setWidth(0);
    itemValue.setGravity(Gravity.LEFT);
    itemValue.setText(value);
    
    netItemLayout.addView(itemValue);
    
    netLayout.addView(netItemLayout);
    
    final View divider = new View(activity);
    divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv,
            1));
    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);
    
    divider.setBackgroundResource(R.drawable.bg_trans_light_10);
    
    netLayout.addView(divider);
    
    netLayout.invalidate();
}