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

The following examples show how to use android.widget.LinearLayout#setClipChildren() . 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: MaterialCalendarView.java    From monthweekmaterialcalendarview with Apache License 2.0 6 votes vote down vote up
private void setupChildren() {

        topbar = new LinearLayout(getContext());
        topbar.setOrientation(LinearLayout.HORIZONTAL);
        topbar.setClipChildren(false);
        topbar.setClipToPadding(false);
        if (showTopBar) {
            addView(topbar, new LayoutParams(1));
        }
        buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

        title.setGravity(Gravity.CENTER);
        topbar.addView(title, new LinearLayout.LayoutParams(
                0, LayoutParams.MATCH_PARENT, DEFAULT_DAYS_IN_WEEK - 2
        ));

        buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

        pager.setId(R.id.mcv_pager);
        pager.setOffscreenPageLimit(1);
        addView(pager, new LayoutParams(calendarMode.visibleWeeksCount + DAY_NAMES_ROW));
    }
 
Example 2
Source File: CalendarView2.java    From calendarview2 with MIT License 6 votes vote down vote up
private void setupChildren() {
    topbar = new LinearLayout(getContext());
    topbar.setOrientation(LinearLayout.HORIZONTAL);
    topbar.setClipChildren(false);
    topbar.setClipToPadding(false);
    addView(topbar, new LayoutParams(1));

    buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

    title.setGravity(Gravity.CENTER);
    topbar.addView(title, new LinearLayout.LayoutParams(
            0, LayoutParams.MATCH_PARENT, DEFAULT_DAYS_IN_WEEK - 2
    ));

    buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

    pager.setId(R.id.mcv_pager);
    pager.setOffscreenPageLimit(1);
    addView(pager, new LayoutParams(calendarMode.visibleWeeksCount + DAY_NAMES_ROW));
}
 
Example 3
Source File: ConversationActivity.java    From deltachat-android with GNU General Public License v3.0 6 votes vote down vote up
private void initializeResources() {
  chatId = getIntent().getIntExtra(CHAT_ID_EXTRA, -1);
  if(chatId == DcChat.DC_CHAT_NO_CHAT)
    throw new IllegalStateException("can't display a conversation for no chat.");
  dcChat           = dcContext.getChat(chatId);
  recipient        = dcContext.getRecipient(dcChat);
  archived         = getIntent().getBooleanExtra(IS_ARCHIVED_EXTRA, false);
  glideRequests    = GlideApp.with(this);


  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
    LinearLayout conversationContainer = ViewUtil.findById(this, R.id.conversation_container);
    conversationContainer.setClipChildren(true);
    conversationContainer.setClipToPadding(true);
  }

  if (!dcChat.canSend()) {
    composePanel.setVisibility(View.GONE);
  }

  if (chatId == DcChat.DC_CHAT_ID_DEADDROP) {
    titleView.hideAvatar();
  }
}
 
Example 4
Source File: ConversationActivity.java    From Silence with GNU General Public License v3.0 6 votes vote down vote up
private void initializeResources() {
  if (recipients != null) recipients.removeListener(this);

  recipients       = RecipientFactory.getRecipientsForIds(this, getIntent().getLongArrayExtra(RECIPIENTS_EXTRA), true);
  threadId         = getIntent().getLongExtra(THREAD_ID_EXTRA, -1);
  archived         = getIntent().getBooleanExtra(IS_ARCHIVED_EXTRA, false);
  distributionType = getIntent().getIntExtra(DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT);

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
    LinearLayout conversationContainer = ViewUtil.findById(this, R.id.conversation_container);
    conversationContainer.setClipChildren(true);
    conversationContainer.setClipToPadding(true);
  }

  recipients.addListener(this);
}
 
Example 5
Source File: MaterialHijriCalendarView.java    From material-hijri-calendarview with Apache License 2.0 6 votes vote down vote up
private void setupChildren() {

        topbar = new LinearLayout(getContext());
        topbar.setOrientation(LinearLayout.HORIZONTAL);
        topbar.setClipChildren(false);
        topbar.setClipToPadding(false);
        addView(topbar, new LayoutParams(1));

        buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        buttonPast.setImageResource(R.drawable.mcv_action_previous);
        topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

        title.setGravity(Gravity.CENTER);
        topbar.addView(title, new LinearLayout.LayoutParams(
                0, LayoutParams.MATCH_PARENT, MonthView.DEFAULT_DAYS_IN_WEEK - 2
        ));

        buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        buttonFuture.setImageResource(R.drawable.mcv_action_next);
        topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

        pager.setId(R.id.mcv_pager);
        pager.setOffscreenPageLimit(1);
        addView(pager, new LayoutParams(MonthView.DEFAULT_MONTH_TILE_HEIGHT));
    }
 
Example 6
Source File: PullToZoomScrollViewEx.java    From likequanmintv with Apache License 2.0 5 votes vote down vote up
@Override
public void handleStyledAttributes(TypedArray a) {
    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    mHeaderContainer = new FrameLayout(getContext());

    if (mZoomView != null) {
        mHeaderContainer.addView(mZoomView);
    }
    if (mHeaderView != null) {
        mHeaderContainer.addView(mHeaderView);
    }
    int contentViewResId = a.getResourceId(R.styleable.PullToZoomView_contentView, 0);
    if (contentViewResId > 0) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
    }

    mRootContainer.addView(mHeaderContainer);
    if (mContentView != null) {
        mRootContainer.addView(mContentView);
    }

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    mRootView.addView(mRootContainer);
}
 
Example 7
Source File: BoardView.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
private void addBoardRow(int rowNum) {

		LinearLayout linearLayout = new LinearLayout(getContext());
		linearLayout.setOrientation(LinearLayout.HORIZONTAL);
		linearLayout.setGravity(Gravity.CENTER);

		for (int tile = 0; tile < mBoardConfiguration.numTilesInRow; tile++) {
			addTile(rowNum * mBoardConfiguration.numTilesInRow + tile, linearLayout);
		}

		// add to this view
		addView(linearLayout, mRowLayoutParams);
		linearLayout.setClipChildren(false);
	}
 
Example 8
Source File: BoardView.java    From memory-game with Apache License 2.0 5 votes vote down vote up
private void addBoardRow(int rowNum) {

		LinearLayout linearLayout = new LinearLayout(getContext());
		linearLayout.setOrientation(LinearLayout.HORIZONTAL);
		linearLayout.setGravity(Gravity.CENTER);

		for (int tile = 0; tile < mBoardConfiguration.numTilesInRow; tile++) {
			addTile(rowNum * mBoardConfiguration.numTilesInRow + tile, linearLayout);
		}

		// add to this view
		addView(linearLayout, mRowLayoutParams);
		linearLayout.setClipChildren(false);
	}
 
Example 9
Source File: PullToZoomScrollViewEx.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleStyledAttributes(TypedArray a) {
    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    mHeaderContainer = new FrameLayout(getContext());

    if (mZoomView != null) {
        mHeaderContainer.addView(mZoomView);
    }
    if (mHeaderView != null) {
        mHeaderContainer.addView(mHeaderView);
    }
    int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
    if (contentViewResId > 0) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
    }

    mRootContainer.addView(mHeaderContainer);
    if (mContentView != null) {
        mRootContainer.addView(mContentView);
    }

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    mRootView.addView(mRootContainer);
}
 
Example 10
Source File: PullToZoomScrollViewEx.java    From PullZoomView with Apache License 2.0 5 votes vote down vote up
@Override
public void handleStyledAttributes(TypedArray a) {
    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    mHeaderContainer = new FrameLayout(getContext());

    if (mZoomView != null) {
        mHeaderContainer.addView(mZoomView);
    }
    if (mHeaderView != null) {
        mHeaderContainer.addView(mHeaderView);
    }
    int contentViewResId = a.getResourceId(R.styleable.PullToZoomView_contentView, 0);
    if (contentViewResId > 0) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
    }

    mRootContainer.addView(mHeaderContainer);
    if (mContentView != null) {
        mRootContainer.addView(mContentView);
    }

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    mRootView.addView(mRootContainer);
}
 
Example 11
Source File: PullToZoomScrollView.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
private void init(AttributeSet attrs) {
    mHeaderContainer = new FrameLayout(getContext());
    mZoomContainer = new FrameLayout(getContext());
    mContentContainer = new FrameLayout(getContext());

    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);

    if (attrs != null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        //初始化状态View
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PullToZoomScrollView);

        int zoomViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollZoomView, 0);
        if (zoomViewResId > 0) {
            mZoomView = mLayoutInflater.inflate(zoomViewResId, null, false);
            mZoomContainer.addView(mZoomView);
            mHeaderContainer.addView(mZoomContainer);
        }

        int headViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollHeadView, 0);
        if (headViewResId > 0) {
            mHeadView = mLayoutInflater.inflate(headViewResId, null, false);
            mHeaderContainer.addView(mHeadView);
        }
        int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
        if (contentViewResId > 0) {
            mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
            mContentContainer.addView(mContentView);
        }

        a.recycle();
    }

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    mScreenHeight = localDisplayMetrics.heightPixels;
    mZoomWidth = localDisplayMetrics.widthPixels;
    mScalingRunnable = new ScalingRunnable();

    mRootContainer.addView(mHeaderContainer);
    mRootContainer.addView(mContentContainer);

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    addView(mRootContainer);
}
 
Example 12
Source File: PullToZoomScrollView.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private void init(AttributeSet attrs) {
    mHeaderContainer = new FrameLayout(getContext());
    mZoomContainer = new FrameLayout(getContext());
    mContentContainer = new FrameLayout(getContext());

    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);

    if (attrs != null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        //初始化状态View
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PullToZoomScrollView);

        int zoomViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollZoomView, 0);
        if (zoomViewResId > 0) {
            mZoomView = mLayoutInflater.inflate(zoomViewResId, null, false);
            mZoomContainer.addView(mZoomView);
            mHeaderContainer.addView(mZoomContainer);
        }

        int headViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollHeadView, 0);
        if (headViewResId > 0) {
            mHeadView = mLayoutInflater.inflate(headViewResId, null, false);
            mHeaderContainer.addView(mHeadView);
        }
        int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
        if (contentViewResId > 0) {
            mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
            mContentContainer.addView(mContentView);
        }

        a.recycle();
    }

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    mScreenHeight = localDisplayMetrics.heightPixels;
    mZoomWidth = localDisplayMetrics.widthPixels;
    mScalingRunnable = new ScalingRunnable();

    mRootContainer.addView(mHeaderContainer);
    mRootContainer.addView(mContentContainer);

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    addView(mRootContainer);
}
 
Example 13
Source File: PullToZoomScrollView.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private void init(AttributeSet attrs) {
    mHeaderContainer = new FrameLayout(getContext());
    mZoomContainer = new FrameLayout(getContext());
    mContentContainer = new FrameLayout(getContext());

    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);

    if (attrs != null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        //初始化状态View
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PullToZoomScrollView);

        int zoomViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollZoomView, 0);
        if (zoomViewResId > 0) {
            mZoomView = mLayoutInflater.inflate(zoomViewResId, null, false);
            mZoomContainer.addView(mZoomView);
            mHeaderContainer.addView(mZoomContainer);
        }

        int headViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollHeadView, 0);
        if (headViewResId > 0) {
            mHeadView = mLayoutInflater.inflate(headViewResId, null, false);
            mHeaderContainer.addView(mHeadView);
        }
        int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
        if (contentViewResId > 0) {
            mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
            mContentContainer.addView(mContentView);
        }

        a.recycle();
    }

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    mScreenHeight = localDisplayMetrics.heightPixels;
    mZoomWidth = localDisplayMetrics.widthPixels;
    mScalingRunnable = new ScalingRunnable();

    mRootContainer.addView(mHeaderContainer);
    mRootContainer.addView(mContentContainer);

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    addView(mRootContainer);
}