Java Code Examples for android.widget.FrameLayout#setClipToPadding()

The following examples show how to use android.widget.FrameLayout#setClipToPadding() . 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: DotWidget.java    From star-zone-android with Apache License 2.0 6 votes vote down vote up
private void addDot(View target) {
    ViewGroup.LayoutParams targetViewParams = target.getLayoutParams();
    ViewGroup.LayoutParams newTargetViewParams = new ViewGroup.LayoutParams(targetViewParams.width, targetViewParams.height);
    targetViewParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    targetViewParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    //new一个容器
    container = new FrameLayout(getContext());
    container.setClipToPadding(false);

    ViewGroup parent = (ViewGroup) target.getParent();
    int index = parent.indexOfChild(target);
    //去掉目标view
    parent.removeView(target);
    //添加容器
    parent.addView(container, index, targetViewParams);

    //容器添加目标view
    container.addView(target, newTargetViewParams);
    setVisibility(GONE);
    //容器添加本view(红点)
    container.addView(this);
    parent.invalidate();
}
 
Example 2
Source File: WelcomeCoordinatorLayout.java    From welcome-coordinator with Apache License 2.0 5 votes vote down vote up
private void buildMainContentView() {
    mainContentView = new FrameLayout(this.getContext());
    mainContentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT));
    mainContentView.setClipToPadding(false);
    mainContentView.setClipChildren(false);
}