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


Java RelativeLayout.removeView方法代码示例

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


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

示例1: createBanner

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void createBanner() {
	RelativeLayout layout = ((Godot)activity).adLayout; // Getting Godots framelayout
	FrameLayout.LayoutParams AdParams = new FrameLayout.LayoutParams(
					 FrameLayout.LayoutParams.MATCH_PARENT,
					 FrameLayout.LayoutParams.WRAP_CONTENT);

	if(moPubView != null) { layout.removeView(moPubView); }

	if (_config.optString("BannerGravity", "BOTTOM").equals("BOTTOM")) {
		AdParams.gravity = Gravity.BOTTOM;
	} else { AdParams.gravity = Gravity.TOP; }

	final String banner_unit_id =
	_config.optString("BannerAdId", activity.getString(R.string.ad_unit_id_banner));

	moPubView = new MoPubView(activity);
	moPubView.setLayoutParams(AdParams);
	moPubView.setAdUnitId(banner_unit_id); // Enter your Ad Unit ID from www.mopub.com
	moPubView.setBannerAdListener(banner_listener);
	moPubView.setAutorefreshEnabled(true);
	moPubView.setVisibility(View.INVISIBLE);
	moPubView.loadAd();

	layout.addView(moPubView);
}
 
开发者ID:FrogSquare,项目名称:GodotAds,代码行数:26,代码来源:GDMopub.java

示例2: populateRecycleView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void populateRecycleView() {
//
        if (!result.isEmpty()) {

            RecyclerView nApp = (RecyclerView) mFloatingView.findViewById(R.id.recyclerView);
            if (result.size() > 4) {
                RelativeLayout main = (RelativeLayout) mFloatingView.findViewById(R.id.up_view);
                RelativeLayout.LayoutParams shape = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, (int) getResources().getDimension(R.dimen.recycle));
                shape.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
              /*  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                    shape.addRule(RelativeLayout.ALIGN_PARENT_START, RelativeLayout.TRUE);
                }*/
                shape.addRule(RelativeLayout.ALIGN_TOP, R.id.up_iv);
                shape.setMargins(220, 220, 0, 0);
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                    nApp.setBackgroundColor(this.getColor(R.color.param));
                } else {
                    //noinspection deprecation
                    nApp.setBackgroundColor(getResources().getColor(R.color.param));
                }
                main.removeView(nApp);
                main.addView(nApp, shape);
            }
            nApp.setLayoutManager(new LinearLayoutManager(FloatingViewServiceOpen.this));
            // nApp.setLayoutManager(new GridLayoutManager(getApplicationContext(),3));
            nApp.setHasFixedSize(true);
            nApp.setAdapter(new RecyclerViewAdapterResult(FloatingViewServiceOpen.this, result));

        } else {
            Toast.makeText(this, "No App Selected Please Select An App", Toast.LENGTH_SHORT).show();
        }

    }
 
开发者ID:HitRoxxx,项目名称:FloatingNew,代码行数:34,代码来源:FloatingViewServiceOpen.java


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