Java Code Examples for android.widget.LinearLayout.setClipToPadding()

The following are Jave code examples for showing how to use setClipToPadding() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GitHub   File: MaterialCalendarView.java   View Source Code Vote up 6 votes
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 2
Project: PeSanKita-android   File: ConversationActivity.java   View Source Code Vote up 6 votes
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 3
Project: edslider   File: EdSliderView.java   View Source Code Vote up 6 votes
/**
 * Generate the view
 * @param builder the configs
 */
public void build(EdSliderBuilder builder)
{
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    LinearLayout layout = new LinearLayout(getContext());
    layout.setLayoutParams(params);
    layout.setOrientation(LinearLayout.HORIZONTAL);
    layout.setBackgroundResource(builder.backgroundResId);
    layout.setClipChildren(false);
    layout.setClipToPadding(false);

    for (EdIcon edIcon : builder.list)
    {
        params = new LinearLayout.LayoutParams(builder.size, builder.size);
        params.setMargins(builder.margin, builder.margin, builder.margin, builder.margin);
        ImageView image = new ImageView(getContext());
        image.setLayoutParams(params);
        image.setImageResource(edIcon.drawableid);
        image.setScaleType(ImageView.ScaleType.FIT_CENTER);

        layout.addView(image);
    }

    this.addView(layout);
    this.manager = builder.manager;
    this.flags = new boolean[builder.list.size()];
    this.boundary = builder.boundary;
    this.isReversed = builder.isReversed;
}
 
Example 4
Project: Cable-Android   File: ConversationActivity.java   View Source Code Vote up 6 votes
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
Project: calendarview2   File: CalendarView2.java   View Source Code Vote up 6 votes
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 6
Project: RLibrary   File: UIItem.java   View Source Code Vote up 6 votes
public static void fill(LinearLayout linearLayout, ArrayList<ItemInfo> itemInfos) {
    for (ItemInfo info : itemInfos) {
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, info.itemHeight);
        TextView textView = makeItem(linearLayout.getContext(), info);

        int paddingLeft = linearLayout.getPaddingLeft();
        if (paddingLeft > 0) {
            params.setMargins(params.leftMargin - paddingLeft, params.topMargin,
                    params.rightMargin, params.bottomMargin);
            textView.setPadding(paddingLeft + textView.getPaddingLeft(), textView.getPaddingTop(),
                    textView.getPaddingRight(), textView.getPaddingBottom());
            linearLayout.setClipToPadding(false);
            linearLayout.setClipChildren(false);
        }

        linearLayout.addView(textView, params);
    }
}
 
Example 7
Project: GitHub   File: ConfirmDialog.java   View Source Code Vote up 5 votes
/**
 * @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);
        int height = ConvertUtils.toPx(activity, topLineHeight);
        lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, height));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    LinearLayout.LayoutParams rootParams = new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f);
    rootParams.setMargins(0,15,0,15);
    rootLayout.addView(makeCenterView(), rootParams);
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}
 
Example 8
Project: MainCalendar   File: ConfirmPopup.java   View Source Code Vote up 5 votes
/**
 * @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(Color.WHITE);
    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, 1));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    rootLayout.addView(makeCenterView(), new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}
 
Example 9
Project: CXJPadProject   File: ConfirmPopup.java   View Source Code Vote up 5 votes
/**
     * @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);
        int padding = ConvertUtils.toPx(activity, contentPaddingLefAndRight);
        rootLayout.setPadding(padding, 0, padding, 0);
        rootLayout.setClipToPadding(false);
        View headerView = makeHeaderView();
        //2017-8-10 lyy 调整头部按钮的显示位置到底部
//        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);
//        }
        rootLayout.addView(makeCenterView(), new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
        View footerView = makeFooterView();
        if (footerView != null) {
            footerView.setPadding(padding, 0, padding, 0);
            rootLayout.addView(footerView);
        }
        if (topLineVisible) {
            View lineView = new View(activity);
            lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, topLineHeightPixels));
            lineView.setBackgroundColor(topLineColor);
            rootLayout.addView(lineView);
        }
        if (headerView != null) {
            rootLayout.addView(headerView);
        }
        return rootLayout;
    }
 
Example 10
Project: cute-currency-view   File: CuteCurrencyView.java   View Source Code Vote up 5 votes
private void init(Context context) {

        setClipToPadding(false);

        FrameLayout.LayoutParams linearLayoutParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        linearLayoutParams.gravity = Gravity.CENTER;

        FrameLayout.LayoutParams editTextLayoutParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        editTextLayoutParams.gravity = Gravity.CENTER;

        animatedPlaceholder = new LinearLayout(context);
        animatedPlaceholder.setVisibility(INVISIBLE);
        animatedPlaceholder.setOrientation(LinearLayout.HORIZONTAL);
        animatedPlaceholder.setClipToPadding(false);
        animatedPlaceholder.setPadding(0, 20, 0, 0);

        actualEditText = new EditText(context);
        actualEditText.setBackground(null);
        actualEditText.setGravity(Gravity.CENTER);
        actualEditText.setIncludeFontPadding(false);
        actualEditText.setVisibility(INVISIBLE);
        actualEditText.setPadding(0, 20, 0, 0);

        if (!TextUtils.isEmpty(text)) actualEditText.setText(text);
        if (!TextUtils.isEmpty(hint)) actualEditText.setHint(hint);
        if (textColor != -1) actualEditText.setTextColor(textColor);
        if (hintColor != -1) actualEditText.setHintTextColor(hintColor);
        if (textSize != -1) actualEditText.setTextSize(textSize);

        addView(animatedPlaceholder, linearLayoutParams);
        addView(actualEditText, editTextLayoutParams);

        if (autoStart) startAnimation();
    }
 
Example 11
Project: AndroidOpen   File: ConfirmPopup.java   View Source Code Vote up 5 votes
/**
 * @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(Color.WHITE);
    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, 1));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    rootLayout.addView(makeCenterView(), new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}