List of usage examples for android.widget FrameLayout setLayoutParams
public void setLayoutParams(ViewGroup.LayoutParams params)
From source file:com.ehelp.home.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params); //fl.setBackgroundColor(0x666666); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params);/*w w w . ja va 2 s . c om*/ v.setGravity(Gravity.TOP); System.out.println(position); if (position == 0) { fl.removeAllViews(); mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL; mMapView = new MapView(getActivity()); mMapView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); fl.addView(mMapView); mBaiduMap = mMapView.getMap(); // ?? mBaiduMap.setMyLocationEnabled(true); // ?? mLocClient = new LocationClient(getActivity()); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true);// gps option.setCoorType("bd09ll"); // ?? option.setScanSpan(1000); mLocClient.setLocOption(option); mLocClient.start(); int count = mMapView.getChildCount(); for (int i = 0; i < count; i++) { View child = mMapView.getChildAt(i); if (child instanceof ZoomControls || child instanceof ImageView) { child.setVisibility(View.INVISIBLE); } } setLocation(); } else if (position == 1) { fl.removeAllViews(); ListView queList = new ListView(getActivity()); queList.setLayoutParams(new LinearLayout.LayoutParams(-1, -1)); HomeAdapter que = new HomeAdapter(getActivity(), user_id, 2, eventCache); queList.setAdapter(que); queList.setDividerHeight(20); fl.addView(queList); events = que.getEvent(); //? queList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) { Intent intent = new Intent(getActivity(), recievesos_map.class); int eventid = events.get(index).getEventId(); intent.putExtra(EXTRA_MESSAGE, eventid); startActivity(intent); } }); } else if (position == 2) { fl.removeAllViews(); ListView queList = new ListView(getActivity()); queList.setLayoutParams(new LinearLayout.LayoutParams(-1, -1)); //queList.setBackgroundColor(0x666666); //queList.setAlpha(125); queList.setDividerHeight(20); HomeAdapter que = new HomeAdapter(getActivity(), user_id, 1, eventCache); queList.setAdapter(que); fl.addView(queList); events = que.getEvent(); //? queList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) { Intent intent = new Intent(getActivity(), recieve_help_ans_map.class); intent.putExtra(EXTRA_MESSAGE, events.get(index)); startActivity(intent); } }); } else if (position == 3) { fl.removeAllViews(); ListView queList = new ListView(getActivity()); queList.setLayoutParams(new LinearLayout.LayoutParams(-1, -1)); HomeAdapter que = new HomeAdapter(getActivity(), user_id, 0, eventCache); queList.setAdapter(que); queList.setDividerHeight(20); fl.addView(queList); events = que.getEvent(); //? queList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) { Intent intent = new Intent(getActivity(), QuestionDetail.class); intent.putExtra("qusetiondatail", events.get(index)); startActivity(intent); } }); } return fl; }
From source file:com.itraing.views.ActionSheet.java
private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(ActionSheet.BG_VIEW_ID);/* w ww. jav a 2s. c o m*/ mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM; mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:com.github.jvanhie.discogsscrobbler.ReleaseVersionsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //setup list view mList = new ListView(getActivity()); mList.setId(android.R.id.list);/*from ww w.j a v a 2 s . c o m*/ mList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { onListItemClick(view, i, l); } }); //create superframe for adding list and empty view FrameLayout superFrame = new FrameLayout(getActivity()); FrameLayout.LayoutParams layoutparams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); superFrame.setLayoutParams(layoutparams); View emptyView = inflater.inflate(R.layout.fragment_empty, container, false); ((TextView) emptyView.findViewById(R.id.empty_heading)).setText("No versions found"); ((TextView) emptyView.findViewById(R.id.empty_text)).setText( "No alternative versions of this release were found, this could also mean Discogs did not add a master id to this release"); /*initialize list with local discogs collection*/ if (mDiscogs == null) mDiscogs = Discogs.getInstance(getActivity()); if (mRelease == null) { mDiscogs.getRelease(getArguments().getLong(ARG_ITEM_ID, 0), new Discogs.DiscogsDataWaiter<Release>() { @Override public void onResult(boolean success, Release data) { if (success) { mRelease = data; loadList(); } } }); } else { loadList(); } superFrame.addView(emptyView); mList.setEmptyView(emptyView); superFrame.addView(mList); return superFrame; }
From source file:com.gudong.appkit.ui.fragment.ColorChooseDialog.java
private View getColorItemView(final Context context, int position, boolean isSelect) { int color = mColors[position]; int widthImageCheckView = Utils.convertDensityPix(context, 24); int widthColorView = Utils.convertDensityPix(context, 56); int widthMargin = Utils.convertDensityPix(context, 4); ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.ic_check); FrameLayout.LayoutParams ivParams = new FrameLayout.LayoutParams(widthImageCheckView, widthImageCheckView); ivParams.gravity = Gravity.CENTER;/* w ww . j a va2 s . com*/ imageView.setLayoutParams(ivParams); imageView.setVisibility(isSelect ? View.VISIBLE : View.INVISIBLE); FrameLayout frameLayout = new FrameLayout(context); GridLayout.LayoutParams params = new GridLayout.LayoutParams( new FrameLayout.LayoutParams(widthColorView, widthColorView)); params.setGravity(Gravity.CENTER); params.setMargins(widthMargin, widthMargin, widthMargin, widthMargin); frameLayout.setLayoutParams(params); setBackgroundSelector(frameLayout, color); frameLayout.addView(imageView); frameLayout.setOnClickListener(this); frameLayout.setTag(position); return frameLayout; }
From source file:com.itude.mobile.mobbl.core.view.components.tabbar.MBDefaultActionBarBuilder.java
@Override public synchronized void showProgressIndicatorInTool() { MBToolDefinition refreshToolDef = getRefreshToolDef(); Menu menu = _menu;/* w ww . j av a 2s . com*/ if (refreshToolDef != null && menu != null) { final MenuItem item = menu.findItem(refreshToolDef.getName().hashCode()); ImageView rotationImage = getRotationImage(); float imageWidth = rotationImage.getDrawable().getIntrinsicWidth(); int framePadding = (int) ((ScreenUtil.convertDimensionPixelsToPixels(_context, 80) - imageWidth) / 2); final FrameLayout frameLayout = new FrameLayout(_context); frameLayout.setLayoutParams( new FrameLayout.LayoutParams(ScreenUtil.convertDimensionPixelsToPixels(_context, 80), LayoutParams.WRAP_CONTENT, Gravity.CENTER)); frameLayout.setPadding(framePadding, 0, framePadding, 0); frameLayout.addView(rotationImage); MBViewManager.getInstance().runOnUiThread(new MBThread() { @Override public void runMethod() { //item.setIcon(null); MenuItemCompat.setActionView(item, frameLayout); getRotationImage().getAnimation().startNow(); } }); } }
From source file:com.mci.firstidol.view.ActionSheet.java
@SuppressWarnings("deprecation") private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(ActionSheet.BG_VIEW_ID);//w w w. ja v a2s . c o m mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM; mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); TextView titleView = new TextView(getActivity()); titleView.setText(TextUtils.isEmpty(getTitle()) ? "" : getTitle()); titleView.setGravity(Gravity.CENTER); titleView.setTextColor(Color.GRAY); titleView.setBackgroundDrawable(mAttrs.actionSheetTitleBackground); mPanel.addView(titleView); parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:com.example.mapsample.view.ActionSheet.java
private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(ActionSheet.BG_VIEW_ID);/*from ww w . j a va 2 s . c om*/ mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM; mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); parent.setPadding(0, 0, 0, getNavBarHeight(getActivity())); parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:com.shenzhen.elson.selectordialoglib.SelectorDialog.java
private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(SelectorDialog.BG_VIEW_ID); mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM;/* w ww. jav a 2s . c o m*/ mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); parent.setPadding(0, 0, 0, getNavBarHeight(getActivity())); parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:com.abhi.barcode.frag.libv2.BarcodeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FrameLayout frameLayout = new FrameLayout(getActivity()); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);/* www . j ava 2 s . co m*/ frameLayout.setLayoutParams(layoutParams); surfaceView = new SurfaceView(getActivity()); surfaceView.setLayoutParams(layoutParams); viewfinderView = new ViewfinderView(getActivity()); viewfinderView.setLayoutParams(layoutParams); frameLayout.addView(surfaceView); frameLayout.addView(viewfinderView); View v = frameLayout; inactivityTimer = new InactivityTimer(this.getActivity()); ambientLightManager = new AmbientLightManager(this.getActivity()); return v; }
From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java
private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(ActionSheet.BG_VIEW_ID);/*from ww w . ja v a 2 s . c o m*/ mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM; mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); if (checkDeviceHasNavigationBar(getActivity())) { parent.setPadding(0, 0, 0, getNavBarHeight(getActivity())); } else { parent.setPadding(0, 0, 0, 0); } parent.addView(mBg); parent.addView(mPanel); return parent; }