本文整理匯總了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);
}
示例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();
}
}