List of usage examples for android.widget RelativeLayout ALIGN_PARENT_BOTTOM
int ALIGN_PARENT_BOTTOM
To view the source code for android.widget RelativeLayout ALIGN_PARENT_BOTTOM.
Click Source Link
From source file:com.admin.control.ab.AbSlidingPlayView.java
/** * ???View.// w ww.j a v a 2 s . c o m * * @param context the context */ public void initView(Context context) { this.context = context; //TODO >> layoutParamsFF = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layoutParamsFW = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParamsWF = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); //TODO << navLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); //ViewPager,fragmentsetId()id // mViewPager.setId(1985); // mNavLayoutParent = new LinearLayout(context); mNavLayoutParent.setPadding(0, 5, 0, 5); navLinearLayout = new LinearLayout(context); navLinearLayout.setPadding(15, 1, 15, 1); navLinearLayout.setVisibility(View.INVISIBLE); mNavLayoutParent.addView(navLinearLayout, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mNavLayoutParent, lp2); addView(mRelativeLayout, layoutParamsFW); // addView(mRelativeLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); //? displayImage = ABFileUtil.getBitmapFromSrc("play_display.png"); hideImage = ABFileUtil.getBitmapFromSrc("play_hide.png"); mListViews = new ArrayList<>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { if (mAbScrolledListener != null) { if (position == 0) mAbScrolledListener.onScrollToLeft(); if (position == mListViews.size() - 1) mAbScrolledListener.onScrollToRight(); } setNowPlayIndex(position); makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }
From source file:org.loon.framework.android.game.LGameActivity.java
public void initialization(Bundle icicle, final boolean landscape, final boolean openAD, final LAD lad, final String publisherId, final String keywords, final int requestInterval) { LSystem.gc();// w w w .j a va 2 s. c om this.androidSelect = -2; frameLayout = new FrameLayout(LGameActivity.this); super.onCreate(icicle); if (openAD) { // setVolumeControlStream(AudioManager.STREAM_MUSIC); AdManager.setPublisherId(publisherId); AdManager.setTestDevices(new String[] { "" }); AdManager.setAllowUseOfLocation(true); view = new LGameView(LGameActivity.this, landscape); adview = new AdView(LGameActivity.this); adview.setKeywords(keywords); adview.setRequestInterval(requestInterval); adview.setGravity(Gravity.NO_GRAVITY); RelativeLayout rl = new RelativeLayout(LGameActivity.this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); if (lad == LAD.LEFT) { lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1); } else if (lad == LAD.RIGHT) { lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1); } else if (lad == LAD.TOP) { lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1); } else { lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1); } visible = true; adview.requestFreshAd(); frameLayout.addView(view); rl.addView(adview, lp); frameLayout.addView(rl); } else { view = new LGameView(LGameActivity.this, landscape); frameLayout.addView(view); } if (view != null) { gameHandler = view.getGameHandler(); } }
From source file:cn.org.eshow.framwork.activity.AbActivity.java
/** * ?????.// w ww. j av a 2s .c o m * * @param overlay the new title bar overlay */ public void setTitleBarOverlay(boolean overlay) { ab_base.removeAllViews(); if (overlay) { RelativeLayout.LayoutParams layoutParamsFW1 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW1.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsFW1); RelativeLayout.LayoutParams layoutParamsFW2 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW2.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); ab_base.addView(mAbTitleBar, layoutParamsFW2); RelativeLayout.LayoutParams layoutParamsFW3 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW3.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsFW3); } else { ab_base.addView(mAbTitleBar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams layoutParamsFW2 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsFW2); RelativeLayout.LayoutParams layoutParamsFW1 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW1.addRule(RelativeLayout.BELOW, mAbTitleBar.getId()); layoutParamsFW1.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsFW1); } }
From source file:mobisocial.musubi.ui.fragments.FeedViewFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); WizardStepHandler.accomplishTask(mActivity, WizardStepHandler.TASK_OPEN_FEED); mSendTextButton = (Button) view.findViewById(R.id.send_text); mSendTextButton.setOnClickListener(mSendStatus); mSendTextButton.setEnabled(false);/*from w w w . j a va 2 s. c o m*/ mStatusText = (EditText) view.findViewById(R.id.status_text); mStatusText.setOnEditorActionListener(FeedViewFragment.this); mStatusText.addTextChangedListener(FeedViewFragment.this); view.findViewById(R.id.pick_app).setOnClickListener(mPickApp); mInputBar = (View) view.findViewById(R.id.input_bar); mInputBar.setBackgroundColor(Color.WHITE); mListView = getListView(); mListView.setFastScrollEnabled(true); mListView.setOnItemClickListener(mItemClickListener); mListView.setOnItemLongClickListener(mItemLongClickListener); mListView.setOnScrollListener(this); mListView.setFocusable(true); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(0, RelativeLayout.LayoutParams.FILL_PARENT); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); ((MusubiBaseActivity) getActivity()).setOnKeyListener(this); }
From source file:com.dvdprime.mobile.android.ui.DocumentViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock_Light); requestWindowFeature(Window.FEATURE_PROGRESS); super.onCreate(savedInstanceState); // Initialize WebView mWebView = new DpWebView(this); mWebView.setId(mWebView.hashCode()); mWebView.setOnCreateContextMenuListener(this); // Initialize Ad. mAdManager = new DpAdManager(); mAdManager.onCreate(this); mLayout = new RelativeLayout(this); mAdView = new DpAdViewCore(this); mAdView.setId(mAdView.hashCode());/*from w w w . ja va2s. c om*/ RelativeLayout.LayoutParams layoutParams1 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layoutParams1.addRule(RelativeLayout.ABOVE, mAdView.getId()); mLayout.addView(mWebView, layoutParams1); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); mLayout.addView(mAdView, layoutParams2); mAdManager.bindCoreView(mAdView); setContentView(mLayout); // Initialize pull to refresh mPullToRefreshAttacher = PullToRefreshAttacher.get(this); mPullToRefreshAttacher.addRefreshableView(mWebView, this); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mLayout.findViewById(mAdView.getId()).setVisibility(View.GONE); } this.overridePendingTransition(R.anim.start_enter, R.anim.start_exit); this.mActivity = this; Bundle bundle = getIntent().getExtras(); if (bundle != null) { try { index = bundle.getInt("index", 0); Document doc = (Document) DpApp.getDocumentList().get(this.index); getSupportActionBar().setTitle(doc.getUserName()); getSupportActionBar().setSubtitle(doc.getTitle()); mUrl = Config.getAbsoluteUrl("/bbs" + doc.getUrl()); } catch (Exception e) { } } Uri uri = getIntent().getData(); if (uri != null) { this.mUrl = uri.toString(); if (getIntent().getExtras().getString("targetKey") != null) { mTargetKey = getIntent().getExtras().getString("targetKey"); } } if (StringUtil.isBlank(this.mUrl)) { finish(); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); // Initialize EventBus EventBusProvider.getInstance().register(this, String.class, new Class[] { Refresh.class }); // Request Document View StringRequest req = new StringRequest(0, this.mUrl, createReqSuccessListener(), createReqErrorListener()); req.setTag(this.TAG); DpApp.getRequestQueue().add(req); // Initialize Google Analytics EasyTracker.getInstance().setContext(this.mActivity); EasyTracker.getTracker().sendView("DocView"); LogUtil.LOGD("Tracker", "DocView"); }
From source file:com.discord.chipsview.ChipsView.java
private void init() { mDensity = getResources().getDisplayMetrics().density; mChipsContainer = new RelativeLayout(getContext()); addView(mChipsContainer);//from w w w . j a v a 2s. com // Dummy item to prevent AutoCompleteTextView from receiving focus LinearLayout linearLayout = new LinearLayout(getContext()); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(0, 0); linearLayout.setLayoutParams(params); linearLayout.setFocusable(true); linearLayout.setFocusableInTouchMode(true); mChipsContainer.addView(linearLayout); mEditText = new ChipsEditText(getContext(), this); final int chipHeightWithPadding = (int) ((CHIP_HEIGHT * mDensity) + mVerticalSpacing); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, chipHeightWithPadding); layoutParams.leftMargin = (int) (5 * mDensity); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mEditText.setLayoutParams(layoutParams); mEditText.setPadding(0, 0, 0, mVerticalSpacing); mEditText.setBackgroundColor(Color.argb(0, 0, 0, 0)); mEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); mEditText.setInputType(InputType.TYPE_CLASS_TEXT); mEditText.setTextColor(mChipsSearchTextColor); mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mChipsSearchTextSize); mChipsContainer.addView(mEditText); mRootChipsLayout = new ChipsVerticalLinearLayout(getContext(), chipHeightWithPadding); mRootChipsLayout.setOrientation(LinearLayout.VERTICAL); mRootChipsLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mRootChipsLayout.setPadding(0, (int) (SPACING_TOP * mDensity), 0, 0); mChipsContainer.addView(mRootChipsLayout); initListener(); onChipsChanged(false); }
From source file:net.gaast.giggity.ScheduleViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (Giggity) getApplication();/*from w w w . j a v a2 s . c o m*/ pref = PreferenceManager.getDefaultSharedPreferences(app); curView = getResources() .getIdentifier(pref.getString("default_view", "net.gaast.giggity:id/block_schedule"), null, null); showHidden = pref.getBoolean("show_hidden", false); /* Consider making this a setting, some may find their tablet too small. */ int screen = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; tabletView = (screen >= Configuration.SCREENLAYOUT_SIZE_LARGE); setContentView(R.layout.schedule_view_activity); View dl = drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); drawer = (RelativeLayout) dl.findViewById(R.id.drawer); drawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // NOOP at least for now just so touches don't fall through to bigScreen. } }); ViewGroup menu = (LinearLayout) dl.findViewById(R.id.menu); menu.getChildCount(); /* Set event handler for all static buttons, going to the option menu code. Dynamic buttons * (from the schedule) have their own handlers. */ for (int i = 0; i < menu.getChildCount(); ++i) { View btn = menu.getChildAt(i); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Not for now as I can't undo it (toggler not calling handlers?) TODO v.setBackground(getResources().getDrawable(R.drawable.menu_gradient)); onOptionsItemSelectedInt(v.getId()); drawerLayout.closeDrawers(); } }); } if (wantDrawer) { /* Hamburger menu! */ /* Should still consider v7-appcompat, depending on how much it, again, affects apk size.. */ getActionBar().setDisplayHomeAsUpEnabled(true); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_menu_white_24dp, R.string.navdrawer_on, R.string.navdrawer_off) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); invalidateOptionsMenu(); /* Looks like this code doesn't actually run BTW. Need to figure that out later. */ updateNavDrawer(); } @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); invalidateOptionsMenu(); } }; } else { drawerLayout.removeView(drawer); } bigScreen = (LinearLayout) dl.findViewById(R.id.bigScreen); updateOrientation(getResources().getConfiguration().orientation); viewerContainer = (RelativeLayout) dl.findViewById(R.id.viewerContainer); /* TODO: See if I can do this in XML as well? (It's a custom private view.) */ RelativeLayout.LayoutParams lp; lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); days = new DayButtons(this); viewerContainer.addView(days, lp); redraw = false; timer = new Handler(); /* If the OS informs us that the timezone changes, close this activity so the schedule gets reloaded. (This because input is usually TZ-unaware while our objects aren't.) */ tzClose = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { ScheduleViewActivity.this.finish(); } }; registerReceiver(tzClose, new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED)); if (!getIntent().getAction().equals(Intent.ACTION_VIEW)) return; String url = getIntent().getDataString(); Fetcher.Source fs; if (getIntent().getBooleanExtra("PREFER_CACHED", false)) fs = Fetcher.Source.CACHE_ONLINE; else fs = Fetcher.Source.ONLINE_CACHE; /* I think reminders come in via this activity (instead of straight to itemview) because we may have to reload schedule data? */ if (url.contains("#")) { String parts[] = url.split("#", 2); url = parts[0]; showEventId = parts[1]; } if (app.hasSchedule(url)) { try { sched = app.getSchedule(url, fs); } catch (Exception e) { // Java makes me tired. e.printStackTrace(); } onScheduleLoaded(); } else { loadScheduleAsync(url, fs); } }
From source file:co.lujun.popmenulayout.PopMenuLayout.java
private void init(Context context, AttributeSet attrs, int defStyleAttr) { initAttrs(context, attrs, defStyleAttr); mMenuShow = new boolean[SUPPORT_MENU_LEVEL]; for (int i = 0; i < SUPPORT_MENU_LEVEL; i++) { mMenuShow[i] = i == 0;// ww w . j a v a 2 s . co m } mContext = context; mMenus = new ArrayList<MenuBean>(); m1LevelMenuAdapter = new MenuAdapter(mContext, mMenus, mLayoutManagerOrientation); m1LevelMenuAdapter.setMenuHeight((int) mLevel1MenuItemHeight); m1LevelMenuAdapter.setOnMenuClickListener(new OnMenuClickListener() { @Override public void onMenuClick(int level1Index, int level2Index, int level3Index) { dealMenuClickEvent(level1Index, level2Index, level3Index); } }); invalidateViewsAttr(); recyclerView = new RecyclerView(mContext, attrs, defStyleAttr); recyclerView.setId(R.id.recyclerView); mLayoutManager = new LinearLayoutManager(mContext); mLayoutManager.setOrientation(mLayoutManagerOrientation); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setBackgroundColor(mLevel1MenuLayoutBgColor); LayoutParams params = new LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); recyclerView.setLayoutParams(params); addView(recyclerView); }
From source file:com.github.yggie.pulltorefresh.PullListFragment.java
/** * Called to do initial creation of the fragment. Creates all the Views in code * * @param inflater The LayoutInflater/* ww w. j a v a 2 s . c om*/ * @param container The parent container * @param savedInstanceState The saved pullState * @return The inflated view */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); // setup the list view listView = new CustomListView(this); listView.setId(ID_LIST_VIEW); final RelativeLayout.LayoutParams listViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); listViewParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); listViewParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); listView.setLayoutParams(listViewParams); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { onListItemClick((ListView) adapterView, view, position, id); } }); // setup the empty view final TextView textView = new TextView(context); textView.setLayoutParams(listViewParams); textView.setGravity(Gravity.CENTER); textView.setText("Nothing to show"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18.0f); emptyView = textView; emptyView.setId(ID_EMPTY_VIEW); // setup top pulled view final RelativeLayout.LayoutParams topViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); topViewParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); topViewParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); final FrameLayout topFrameLayout = new FrameLayout(context); topFrameLayout.setLayoutParams(topViewParams); // setup the default child of the FrameLayout topManager = new DefaultPulledView(this, true); topFrameLayout.addView(topManager); topPulledView = topFrameLayout; topPulledView.setId(ID_TOP_VIEW); // setup bottom pulled view final RelativeLayout.LayoutParams bottomViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); bottomViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); bottomViewParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); final FrameLayout bottomFrameLayout = new FrameLayout(context); bottomFrameLayout.setLayoutParams(bottomViewParams); // setup the default child in the FrameLayout bottomManager = new DefaultPulledView(this, false); bottomFrameLayout.addView(bottomManager); bottomPulledView = bottomFrameLayout; bottomPulledView.setId(ID_BOTTOM_VIEW); layout = new PullToRefreshLayout(this); layout.addView(topPulledView); layout.addView(bottomPulledView); layout.addView(listView); layout.addView(emptyView); layout.setId(ID_LAYOUT); listShown = false; listView.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); // applies the XML attributes, if exists if (attrs != null) { final TypedArray a = getActivity().obtainStyledAttributes(attrs, R.styleable.PullListFragment); if (a != null) { parseXmlAttributes(a); a.recycle(); } attrs = null; } return layout; }
From source file:org.loon.framework.android.game.LGameAndroid2DActivity.java
public void initialization(final boolean landscape, final boolean openAD, final Location lad, final String publisherId, final String keywords, final int requestInterval) { if (openAD) { // setVolumeControlStream(AudioManager.STREAM_MUSIC); AdManager.setPublisherId(publisherId); AdManager.setTestDevices(new String[] { "" }); AdManager.setAllowUseOfLocation(true); view = new LGameAndroid2DView(LGameAndroid2DActivity.this, landscape); IHandler handler = view.getGameHandler(); RelativeLayout mainLayout = new RelativeLayout(LGameAndroid2DActivity.this); RelativeLayout.LayoutParams mainParams = new RelativeLayout.LayoutParams(handler.getWidth(), handler.getHeight());/*from w ww . j av a2s . c om*/ if (landscape) { mainParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); } else { mainParams.addRule(RelativeLayout.CENTER_IN_PARENT, 1); } mainLayout.addView(view, mainParams); adview = new AdView(LGameAndroid2DActivity.this); if (keywords != null) { adview.setKeywords(keywords); } adview.setRequestInterval(requestInterval); adview.setGravity(Gravity.NO_GRAVITY); RelativeLayout rl = new RelativeLayout(LGameAndroid2DActivity.this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); if (lad == Location.LEFT) { lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1); } else if (lad == Location.RIGHT) { lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1); } else if (lad == Location.TOP) { lp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 1); } else { lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1); } // adview.setVisibility(View.GONE); visible = true; frameLayout.addView(mainLayout); rl.addView(adview, lp); frameLayout.addView(rl); } else { view = new LGameAndroid2DView(LGameAndroid2DActivity.this, landscape); IHandler handler = view.getGameHandler(); RelativeLayout mainLayout = new RelativeLayout(LGameAndroid2DActivity.this); RelativeLayout.LayoutParams mainParams = new RelativeLayout.LayoutParams(handler.getWidth(), handler.getHeight()); if (landscape) { mainParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); } else { mainParams.addRule(RelativeLayout.CENTER_IN_PARENT, 1); } mainLayout.addView(view, mainParams); frameLayout.addView(mainLayout); } if (setupSensors) { // ?? this.initSensors(); } if (view != null) { gameHandler = view.getGameHandler(); } }