当前位置: 首页>>代码示例>>Java>>正文


Java FrameLayout.setPadding方法代码示例

本文整理汇总了Java中android.widget.FrameLayout.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.setPadding方法的具体用法?Java FrameLayout.setPadding怎么用?Java FrameLayout.setPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.FrameLayout的用法示例。


在下文中一共展示了FrameLayout.setPadding方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: show

import android.widget.FrameLayout; //导入方法依赖的package包/类
public static void show(Context context, int color, CharSequence string, int duration) {
	if(context == null) return;

	DisplayMetrics dm = context.getResources().getDisplayMetrics();
	float density = dm.density;
	Toast toast = new Toast(context);
	toast.setDuration(duration);
	toast.setGravity(Gravity.TOP, 0, (int) (48 * density));
	FrameLayout frame = new FrameLayout(context);
	frame.setPadding(0, 0, 0, 0);
	int width = dm.widthPixels;
	FrameLayout.LayoutParams params =
			new FrameLayout.LayoutParams(width, FrameLayout.LayoutParams.WRAP_CONTENT);
	TextView text = new TextView(context);
	text.setMinimumHeight((int) (28 * density));
	text.setGravity(Gravity.CENTER);
	text.setTextColor(Color.WHITE);
	text.setTextSize(14);
	frame.addView(text, params);
	toast.setView(frame);

	text.setBackgroundColor(color);
	text.setText(string);
	toast.show();
}
 
开发者ID:marven88cn,项目名称:SwipeCard-,代码行数:26,代码来源:AppToast.java

示例2: makeColorPresetButton

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void makeColorPresetButton(int color) {
        FrameLayout outframe = new FrameLayout(getContext());
        outframe.setBackgroundColor(Color.BLACK);
        outframe.setPadding(6,6,6,6);

        FrameLayout frame = new FrameLayout(getContext());
        //frame.setBackgroundColor(Color.BLACK);
        frame.setBackgroundResource(R.drawable.transparentgrid);

        TextView c = new TextView(getContext());
        c.setText("   ");
        c.setTextSize(22);
        c.setBackgroundColor(color);
//        if (color==Color.TRANSPARENT) {
//            c.setBackgroundResource(R.drawable.transparentgrid);
//        }
        c.setTag(color);
        c.setClickable(true);
        c.setOnClickListener(setColorListener);
        frame.addView(c);
        GridLayout.LayoutParams lp = new GridLayout.LayoutParams();
        lp.setMargins(24, 16, 24, 16);
        outframe.setPadding(6,6,6,6);
        outframe.addView(frame);
        colorPresets.addView(outframe, lp);
    }
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:27,代码来源:ColorChooser.java

示例3: onCreate

import android.widget.FrameLayout; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState)
{
    ThemeHue.setTheme(WebViewActivity.this);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fragment_star_webview);
    Intent intent = getIntent();

    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ActionBarHue.setActionBarColorToSharedPrefsValue(WebViewActivity.this);

    if (intent.getAction().equals(Intent.ACTION_VIEW))
    {
        mURL = intent.getStringExtra("url");
    }

    FrameLayout parent = findViewById(R.id.webview_parent);
    parent.setPadding(0, 0, 0, 0);

    final WebView webView = findViewById(R.id.stars_view);

    CustomWebView customWebView = new CustomWebView(this, parent, webView, true);
    customWebView.loadUrl(mURL);
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:28,代码来源:WebViewActivity.java

示例4: onInflateView

import android.widget.FrameLayout; //导入方法依赖的package包/类
@NonNull
@Override
public final View onInflateView(@NonNull final LayoutInflater inflater,
                                @Nullable final ViewGroup parent, @NonNull final Tab item,
                                final int viewType, @NonNull final Void... params) {
    View view = encapsulatedAdapter.onInflateView(inflater, parent, item, viewType, params);
    FrameLayout container = new FrameLayout(tabSwitcher.getContext());
    container.setPadding(tabSwitcher.getPaddingLeft(), 0, tabSwitcher.getPaddingRight(),
            tabSwitcher.getPaddingBottom());
    container.setLayoutParams(
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT));
    container.addView(view);
    return container;
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:16,代码来源:TabletContentRecyclerAdapterWrapper.java

示例5: setupCustomContent

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void setupCustomContent(ViewGroup customPanel) {
    View customView;
    boolean hasCustomView = false;
    if (this.mView != null) {
        customView = this.mView;
    } else if (this.mViewLayoutResId != 0) {
        customView = LayoutInflater.from(this.mContext).inflate(this.mViewLayoutResId, customPanel, false);
    } else {
        customView = null;
    }
    if (customView != null) {
        hasCustomView = true;
    }
    if (!(hasCustomView && canTextInput(customView))) {
        this.mWindow.setFlags(131072, 131072);
    }
    if (hasCustomView) {
        FrameLayout custom = (FrameLayout) this.mWindow.findViewById(R.id.custom);
        custom.addView(customView, new LayoutParams(-1, -1));
        if (this.mViewSpacingSpecified) {
            custom.setPadding(this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);
        }
        if (this.mListView != null) {
            ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0.0f;
            return;
        }
        return;
    }
    customPanel.setVisibility(8);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:AlertController.java

示例6: setupCustomContent

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void setupCustomContent(ViewGroup customPanel) {
    final View customView;
    if (mView != null) {
        customView = mView;
    } else if (mViewLayoutResId != 0) {
        final LayoutInflater inflater = LayoutInflater.from(mContext);
        customView = inflater.inflate(mViewLayoutResId, customPanel, false);
    } else {
        customView = null;
    }

    if (customView != null && mViewRoot == null) {
        if (mViewRootId != 0) {
            mViewRoot = customView.findViewById(mViewRootId);

            if (mViewRoot == null) {
                throw new NullPointerException("Unable to find root view for the supplied id "
                        + mViewRootId + ".");
            }
        }
    }

    final boolean hasCustomView = customView != null;
    if (!hasCustomView || !canTextInput(customView)) {
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
                WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    }

    if (hasCustomView) {
        final FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
        custom.addView(customView, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

        if (mViewSpacingSpecified) {
            custom.setPadding(
                    mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
        }

        if (mListView != null) {
            ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
        }
    } else {
        customPanel.setVisibility(View.GONE);
    }
}
 
开发者ID:pranavpandey,项目名称:dynamic-dialogs,代码行数:45,代码来源:DynamicAlertController.java

示例7: updateCourseViews

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
     * 更新课表View
     */
    public void updateCourseViews() {

        for (final SScheduleViewModelInterface data : courseDataList) {
            FrameLayout courseBackView = new FrameLayout(getContext());

            FrameLayout.LayoutParams courseBackViewFLP = new FrameLayout.LayoutParams(notFirstEveryColumnsWidth,
                    notFirstEveryRowHeight * data.getSpan());
            courseBackViewFLP.setMargins((data.getDay() - 1) * notFirstEveryColumnsWidth, (data.getJieci() - 1) * notFirstEveryRowHeight, 0, 0);
            courseBackView.setLayoutParams(courseBackViewFLP);
            courseBackView.setPadding(twoW, twoW, twoW, twoW);
            TextView couseInfoTV=mAdapter.getCourseView(data);
//            TextView couseInfoTV = new TextView(getContext());
//            couseInfoTV.setText(data.getCourseName() + "\n" + data.getClassRoom());
//            couseInfoTV.setTextColor(Color.WHITE);
//            couseInfoTV.setGravity(Gravity.CENTER);
//            couseInfoTV.setPadding(oneW, oneW, oneW, oneW);
//            couseInfoTV.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
//            couseInfoTV.setEllipsize(TextUtils.TruncateAt.END);
//            couseInfoTV.setLines(7);

            // 设置背景颜色
//            int bg = new Random().nextInt(SScheduleTheme.COURSE_BG.length - 1);
//            couseInfoTV.setBackgroundResource(SScheduleTheme.COURSE_BG[bg]);
//            if (data.getBackColor() != 0) {
//                GradientDrawable myGrad = (GradientDrawable) couseInfoTV.getBackground();
//                myGrad.setColor(data.getBackColor());
//            }

            courseBackViewFLP = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT);
            couseInfoTV.setLayoutParams(courseBackViewFLP);
            couseInfoTV.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    callBack.onCourseItemClick(data);
                }
            });

            courseBackView.addView(couseInfoTV);
            myCacheViews.add(courseBackView);
            contentView.addView(courseBackView);
        }
    }
 
开发者ID:huangshuai-IOT,项目名称:SScheduleView-Android,代码行数:46,代码来源:SScheduleView.java

示例8: insetKeyboardView

import android.widget.FrameLayout; //导入方法依赖的package包/类
private static void insetKeyboardView(View decorView, FrameLayout keyboardWrapper) {
    final Rect rect = new Rect();
    decorView.getWindowVisibleDisplayFrame(rect);
    final int paddingBottom = decorView.getHeight() - rect.bottom;
    keyboardWrapper.setPadding(0, 0, 0, paddingBottom);
}
 
开发者ID:parkingwang,项目名称:vehicle-keyboard-android,代码行数:7,代码来源:PopupHelper.java


注:本文中的android.widget.FrameLayout.setPadding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。