android.widget.LinearLayout#setClipToPadding ( )源码实例Demo

下面列出了android.widget.LinearLayout#setClipToPadding ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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));
    }
 
源代码2 项目: calendarview2   文件: CalendarView2.java
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));
}
 
源代码3 项目: deltachat-android   文件: ConversationActivity.java
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();
  }
}
 
源代码4 项目: Silence   文件: ConversationActivity.java
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);
}
 
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));
    }
 
源代码6 项目: a   文件: ConfirmPopup.java
/**
 * @see #makeHeaderView()
 * @see #makeCenterView()
 * @see #makeFooterView()
 */
@Override
protected final View makeContentView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setBackgroundColor(backgroundColor);
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    rootLayout.setGravity(Gravity.CENTER);
    rootLayout.setPadding(0, 0, 0, 0);
    rootLayout.setClipToPadding(false);
    View headerView = makeHeaderView();
    if (headerView != null) {
        rootLayout.addView(headerView);
    }
    if (topLineVisible) {
        View lineView = new View(activity);
        lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, topLineHeightPixels));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    if (centerView == null) {
        centerView = makeCenterView();
    }
    int lr = 0;
    int tb = 0;
    if (contentLeftAndRightPadding > 0) {
        lr = ConvertUtils.toPx(activity, contentLeftAndRightPadding);
    }
    if (contentTopAndBottomPadding > 0) {
        tb = ConvertUtils.toPx(activity, contentTopAndBottomPadding);
    }
    centerView.setPadding(lr, tb, lr, tb);
    ViewGroup vg = (ViewGroup) centerView.getParent();
    if (vg != null) {
        //IllegalStateException: The specified child already has a parent
        vg.removeView(centerView);
    }
    rootLayout.addView(centerView, new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}
 
源代码7 项目: MyBookshelf   文件: ConfirmPopup.java
/**
 * @see #makeHeaderView()
 * @see #makeCenterView()
 * @see #makeFooterView()
 */
@Override
protected final View makeContentView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setBackgroundColor(backgroundColor);
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    rootLayout.setGravity(Gravity.CENTER);
    rootLayout.setPadding(0, 0, 0, 0);
    rootLayout.setClipToPadding(false);
    View headerView = makeHeaderView();
    if (headerView != null) {
        rootLayout.addView(headerView);
    }
    if (topLineVisible) {
        View lineView = new View(activity);
        lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, topLineHeightPixels));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    if (centerView == null) {
        centerView = makeCenterView();
    }
    int lr = 0;
    int tb = 0;
    if (contentLeftAndRightPadding > 0) {
        lr = ConvertUtils.toPx(activity, contentLeftAndRightPadding);
    }
    if (contentTopAndBottomPadding > 0) {
        tb = ConvertUtils.toPx(activity, contentTopAndBottomPadding);
    }
    centerView.setPadding(lr, tb, lr, tb);
    ViewGroup vg = (ViewGroup) centerView.getParent();
    if (vg != null) {
        //IllegalStateException: The specified child already has a parent
        vg.removeView(centerView);
    }
    rootLayout.addView(centerView, new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}
 
源代码8 项目: AndroidPicker   文件: ConfirmPopup.java
/**
 * @see #makeHeaderView()
 * @see #makeCenterView()
 * @see #makeFooterView()
 */
@Override
protected final View makeContentView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setBackgroundColor(backgroundColor);
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    rootLayout.setGravity(Gravity.CENTER);
    rootLayout.setPadding(0, 0, 0, 0);
    rootLayout.setClipToPadding(false);
    View headerView = makeHeaderView();
    if (headerView != null) {
        rootLayout.addView(headerView);
    }
    if (topLineVisible) {
        View lineView = new View(activity);
        lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, topLineHeightPixels));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    if (centerView == null) {
        centerView = makeCenterView();
    }
    int lr = 0;
    int tb = 0;
    if (contentLeftAndRightPadding > 0) {
        lr = ConvertUtils.toPx(activity, contentLeftAndRightPadding);
    }
    if (contentTopAndBottomPadding > 0) {
        tb = ConvertUtils.toPx(activity, contentTopAndBottomPadding);
    }
    centerView.setPadding(lr, tb, lr, tb);
    ViewGroup vg = (ViewGroup) centerView.getParent();
    if (vg != null) {
        //IllegalStateException: The specified child already has a parent
        vg.removeView(centerView);
    }
    rootLayout.addView(centerView, new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}