List of usage examples for android.view Gravity RIGHT
int RIGHT
To view the source code for android.view Gravity RIGHT.
Click Source Link
From source file:com.inha.stickyonpage.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (getSupportFragmentManager().findFragmentByTag("BrowsingWebView") != null) { if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT) || mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { mDrawerLayout.closeDrawer(Gravity.RIGHT); mDrawerLayout.closeDrawer(Gravity.LEFT); return false; } else { WebView mWebView = (WebView) findViewById(R.id.webView1); if (mWebView.canGoBack()) { mWebView.goBack();//from w ww . j a v a 2 s. c o m } else { ActionBar mActionBar = getActionBar(); mActionBar.setCustomView(null); mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); RecentStickyView stickyFragment = new RecentStickyView(); ft.replace(R.id.drawer_main, stickyFragment, "RecentStickyView"); ft.commit(); } return false; } } else if (getSupportFragmentManager().getBackStackEntryCount() == 0) { if (!mFlag) { Toast.makeText(this, "''? ? ?.", Toast.LENGTH_SHORT).show(); mFlag = true; mHandler.sendEmptyMessageDelayed(0, 2000); return false; } else { finish(); } } } return super.onKeyDown(keyCode, event); }
From source file:com.tmall.wireless.tangram.view.BannerView.java
public void setIndicatorGravity(int gravity) { switch (gravity) { case GRAVITY_LEFT: if (mIndicator != null) { mIndicator.setGravity(Gravity.LEFT); }/*from ww w . j a v a2 s.c o m*/ break; case GRAVITY_CENTER: if (mIndicator != null) { mIndicator.setGravity(Gravity.CENTER_HORIZONTAL); } break; case GRAVITY_RIGHT: if (mIndicator != null) { mIndicator.setGravity(Gravity.RIGHT); } break; } }
From source file:com.hxqc.aroundservice.activity.DriversLicenseChangeActivity.java
@Override public void onClick(View view) { int id = view.getId(); if (id == R.id.change_address) { mDrawerView.openDrawer(Gravity.RIGHT); } else if (id == R.id.change_submit) { String name = mNameView.getText().toString().trim(); if (TextUtils.isEmpty(name)) { ToastHelper.showYellowToast(this, "??"); return; }//from w ww . j a v a 2 s.c o m String phone = mPhoneView.getText().toString().trim(); if (FormatCheck.checkPhoneNumber(phone, this) != FormatCheck.CHECK_SUCCESS) return; if (TextUtils.isEmpty(mProvince) || TextUtils.isEmpty(mCity) || TextUtils.isEmpty(mRegion)) { ToastHelper.showYellowToast(this, "?"); return; } String detail = mAddressDetailView.getText().toString().trim(); if (TextUtils.isEmpty(detail)) { ToastHelper.showYellowToast(this, "?"); return; } String original = mOriginalFragment.getmFilePath(); if (TextUtils.isEmpty(original)) { ToastHelper.showYellowToast(this, "??"); return; } else { original = original.substring(7); } String copy = mCopyFragment.getmFilePath(); if (TextUtils.isEmpty(copy)) { ToastHelper.showYellowToast(this, "??"); return; } else { copy = copy.substring(7); } String front = mFrontFragment.getmFilePath(); if (TextUtils.isEmpty(front)) { ToastHelper.showYellowToast(this, "??"); return; } else { front = front.substring(7); } String back = mBackFragment.getmFilePath(); if (TextUtils.isEmpty(back)) { ToastHelper.showYellowToast(this, "????"); return; } else { back = back.substring(7); } submit(name, phone, detail, original, copy, front, back, view); } }
From source file:android.support.transition.SidePropagation.java
private int distance(View sceneRoot, int viewX, int viewY, int epicenterX, int epicenterY, int left, int top, int right, int bottom) { final int side; if (mSide == Gravity.START) { final boolean isRtl = ViewCompat.getLayoutDirection(sceneRoot) == ViewCompat.LAYOUT_DIRECTION_RTL; side = isRtl ? Gravity.RIGHT : Gravity.LEFT; } else if (mSide == Gravity.END) { final boolean isRtl = ViewCompat.getLayoutDirection(sceneRoot) == ViewCompat.LAYOUT_DIRECTION_RTL; side = isRtl ? Gravity.LEFT : Gravity.RIGHT; } else {//from w w w . j a v a 2 s . c o m side = mSide; } int distance = 0; switch (side) { case Gravity.LEFT: distance = right - viewX + Math.abs(epicenterY - viewY); break; case Gravity.TOP: distance = bottom - viewY + Math.abs(epicenterX - viewX); break; case Gravity.RIGHT: distance = viewX - left + Math.abs(epicenterY - viewY); break; case Gravity.BOTTOM: distance = viewY - top + Math.abs(epicenterX - viewX); break; } return distance; }
From source file:com.thevelopment.poc.Fragments.FirstFragment.java
public FloatingActionButton createFAB(ViewGroup parentView) { FloatingActionButton fab = new FloatingActionButton(getActivity()); fab.setImageResource(R.drawable.ic_go); LinearLayout.LayoutParams fabParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); fabParams.gravity = Gravity.RIGHT; fab.setLayoutParams(fabParams);/*from w w w. ja va2s. c om*/ parentView.addView(fab); return fab; }
From source file:com.tmall.ultraviewpager.UltraViewPagerIndicator.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (viewPager == null || viewPager.getAdapter() == null) return;//from w w w . java2 s.c o m final int count = ((UltraViewPagerAdapter) viewPager.getAdapter()).getRealCount(); if (count == 0) return; int longSize; int shortSize; int longPaddingBefore; int longPaddingAfter; int shortPaddingBefore; int shortPaddingAfter; if (orientation == UltraViewPager.Orientation.HORIZONTAL) { longSize = viewPager.getWidth(); shortSize = viewPager.getHeight(); longPaddingBefore = getPaddingLeft() + marginLeft; longPaddingAfter = getPaddingRight() + marginRight; shortPaddingBefore = getPaddingTop() + marginTop; shortPaddingAfter = (int) paintStroke.getStrokeWidth() + getPaddingBottom() + marginBottom; } else { longSize = viewPager.getHeight(); shortSize = viewPager.getWidth(); longPaddingBefore = getPaddingTop() + marginTop; longPaddingAfter = (int) paintStroke.getStrokeWidth() + getPaddingBottom() + marginBottom; shortPaddingBefore = getPaddingLeft() + marginLeft; shortPaddingAfter = getPaddingRight() + marginRight; } final float itemWidth = getItemWidth(); final int widthRatio = isDrawResIndicator() ? 1 : 2; //bitmap resource X1 : circle X2 if (indicatorPadding == 0) { indicatorPadding = (int) itemWidth; } float shortOffset = shortPaddingBefore; float longOffset = longPaddingBefore; final float indicatorLength = (count - 1) * (itemWidth * widthRatio + indicatorPadding); final int horizontalGravityMask = gravity & Gravity.HORIZONTAL_GRAVITY_MASK; final int verticalGravityMask = gravity & Gravity.VERTICAL_GRAVITY_MASK; switch (horizontalGravityMask) { case Gravity.CENTER_HORIZONTAL: longOffset = (longSize - longPaddingBefore - longPaddingAfter - indicatorLength) / 2.0f; break; case Gravity.RIGHT: if (orientation == UltraViewPager.Orientation.HORIZONTAL) { longOffset = longSize - longPaddingAfter - indicatorLength - itemWidth; } if (orientation == UltraViewPager.Orientation.VERTICAL) { shortOffset = shortSize - shortPaddingAfter - itemWidth; } break; case Gravity.LEFT: longOffset += itemWidth; default: break; } switch (verticalGravityMask) { case Gravity.CENTER_VERTICAL: shortOffset = (shortSize - shortPaddingAfter - shortPaddingBefore - itemWidth) / 2; break; case Gravity.BOTTOM: if (orientation == UltraViewPager.Orientation.HORIZONTAL) { shortOffset = shortSize - shortPaddingAfter - getItemHeight(); } if (orientation == UltraViewPager.Orientation.VERTICAL) { longOffset = longSize - longPaddingAfter - indicatorLength; } break; case Gravity.TOP: shortOffset += itemWidth; default: break; } if (horizontalGravityMask == Gravity.CENTER_HORIZONTAL && verticalGravityMask == Gravity.CENTER_VERTICAL) { shortOffset = (shortSize - shortPaddingAfter - shortPaddingBefore - itemWidth) / 2; } float dX; float dY; float pageFillRadius = radius; if (paintStroke.getStrokeWidth() > 0) { pageFillRadius -= paintStroke.getStrokeWidth() / 2.0f; //TODO may not/2 } //Draw stroked circles for (int iLoop = 0; iLoop < count; iLoop++) { float drawLong = longOffset + (iLoop * (itemWidth * widthRatio + indicatorPadding)); if (orientation == UltraViewPager.Orientation.HORIZONTAL) { dX = drawLong; dY = shortOffset; } else { dX = shortOffset; dY = drawLong; } if (isDrawResIndicator()) { if (iLoop == viewPager.getCurrentItem()) continue; canvas.drawBitmap(normalBitmap, dX, dY, paintFill); } else { // Only paint fill if not completely transparent if (paintFill.getAlpha() > 0) { paintFill.setColor(normalColor); canvas.drawCircle(dX, dY, pageFillRadius, paintFill); } // Only paint stroke if a stroke width was non-zero if (pageFillRadius != radius) { canvas.drawCircle(dX, dY, radius, paintStroke); } } } //Draw the filled circle according to the current scroll float cx = (viewPager.getCurrentItem()) * (itemWidth * widthRatio + indicatorPadding); if (animateIndicator) cx += pageOffset * itemWidth; if (orientation == UltraViewPager.Orientation.HORIZONTAL) { dX = longOffset + cx; dY = shortOffset; } else { dX = shortOffset; dY = longOffset + cx; } if (isDrawResIndicator()) { canvas.drawBitmap(focusBitmap, dX, dY, paintStroke); } else { paintFill.setColor(focusColor); canvas.drawCircle(dX, dY, radius, paintFill); } }
From source file:de.escoand.readdaily.MainActivity.java
@Override public void onBackPressed() { if (layout.isDrawerOpen(Gravity.LEFT) || layout.isDrawerOpen(Gravity.RIGHT)) layout.closeDrawers();//from ww w . j a v a2s . com else super.onBackPressed(); }
From source file:at.alladin.rmbt.android.fragments.history.RMBTFilterFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); view = inflater.inflate(R.layout.history_filter, container, false); deviceListView = (LinearLayout) view.findViewById(R.id.deviceList); networkListView = (LinearLayout) view.findViewById(R.id.networkList); final RelativeLayout resultLimitView = (RelativeLayout) view.findViewById(R.id.Limit25Wrapper); limit25CheckBox = (CheckBox) view.findViewById(R.id.Limit25CheckBox); if (activity.getHistoryResultLimit() == 250) limit25CheckBox.setChecked(true); else//from ww w. jav a2 s. co m limit25CheckBox.setChecked(false); resultLimitView.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { if (limit25CheckBox.isChecked()) { limit25CheckBox.setChecked(false); activity.setHistoryResultLimit(0); } else { limit25CheckBox.setChecked(true); activity.setHistoryResultLimit(250); } } }); devicesToShow = activity.getHistoryFilterDevicesFilter(); networksToShow = activity.getHistoryFilterNetworksFilter(); if (devicesToShow == null && networksToShow == null) { devicesToShow = new ArrayList<String>(); networksToShow = new ArrayList<String>(); } final float scale = activity.getResources().getDisplayMetrics().density; final int leftRightItem = Helperfunctions.dpToPx(5, scale); // int topBottomItem = Helperfunctions.dpToPx(5, scale); // int leftRightDiv = Helperfunctions.dpToPx(0, scale); // int topBottomDiv = Helperfunctions.dpToPx(0, scale); final int heightDiv = Helperfunctions.dpToPx(1, scale); // int topBottomImg = Helperfunctions.dpToPx(1, scale); final String historyDevices[] = activity.getHistoryFilterDevices(); if (historyDevices != null) { for (int i = 0; i < historyDevices.length; i++) { final RelativeLayout singleItemLayout = new RelativeLayout(activity); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item); singleItemLayout.setId(i); singleItemLayout.setClickable(true); singleItemLayout.setBackgroundResource(R.drawable.list_selector); singleItemLayout.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); final TextView itemTitle = new TextView(activity, null, R.style.textMediumLight); RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); layout.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layout.addRule(RelativeLayout.CENTER_VERTICAL); // itemTitle.setLayoutParams(layout); itemTitle.setGravity(Gravity.LEFT); itemTitle.setPadding(leftRightItem, 0, leftRightItem, 0); itemTitle.setText(historyDevices[i]); singleItemLayout.addView(itemTitle, layout); final CheckBox itemCheck = new CheckBox(activity); layout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); layout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layout.addRule(RelativeLayout.CENTER_VERTICAL); // itemCheck.setLayoutParams(layout); itemCheck.setGravity(Gravity.RIGHT); itemCheck.setPadding(leftRightItem, 0, leftRightItem, 0); itemCheck.setOnClickListener(null); itemCheck.setClickable(false); itemCheck.setId(i + historyDevices.length); if (devicesToShow.isEmpty() || devicesToShow.contains(historyDevices[i])) itemCheck.setChecked(true); else itemCheck.setChecked(false); singleItemLayout.addView(itemCheck, layout); // layout = new // RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, // RelativeLayout.LayoutParams.WRAP_CONTENT); // singleItemLayout.setLayoutParams(layout); singleItemLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final CheckBox check = (CheckBox) v.findViewById(v.getId() + historyDevices.length); if (check.isChecked()) { check.setChecked(false); devicesToShow.remove(historyDevices[v.getId()]); } else { check.setChecked(true); devicesToShow.add(historyDevices[v.getId()]); } } }); deviceListView.addView(singleItemLayout); final View divider = new View(activity); layout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv); divider.setBackgroundResource(R.drawable.bg_trans_light_10); deviceListView.addView(divider, layout); } deviceListView.invalidate(); } final String historyNetworks[] = activity.getHistoryFilterNetworks(); if (historyNetworks != null) { for (int i = 0; i < historyNetworks.length; i++) { final RelativeLayout singleItemLayout = new RelativeLayout(activity); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item); singleItemLayout.setId(i); singleItemLayout.setClickable(true); singleItemLayout.setBackgroundResource(R.drawable.list_selector); singleItemLayout.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); final TextView itemTitle = new TextView(activity, null, R.style.textMediumLight); RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); layout.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layout.addRule(RelativeLayout.CENTER_VERTICAL); // itemTitle.setLayoutParams(layout); itemTitle.setGravity(Gravity.LEFT); itemTitle.setPadding(leftRightItem, 0, leftRightItem, 0); itemTitle.setText(historyNetworks[i]); singleItemLayout.addView(itemTitle, layout); final CheckBox itemCheck = new CheckBox(activity); layout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); layout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layout.addRule(RelativeLayout.CENTER_VERTICAL); // itemCheck.setLayoutParams(layout); itemCheck.setGravity(Gravity.RIGHT); itemCheck.setPadding(leftRightItem, 0, leftRightItem, 0); itemCheck.setOnClickListener(null); itemCheck.setClickable(false); itemCheck.setId(i + historyNetworks.length); if (networksToShow.isEmpty() || networksToShow.contains(historyNetworks[i])) itemCheck.setChecked(true); else itemCheck.setChecked(false); singleItemLayout.addView(itemCheck, layout); singleItemLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final CheckBox check = (CheckBox) v.findViewById(v.getId() + historyNetworks.length); if (check.isChecked()) { check.setChecked(false); networksToShow.remove(historyNetworks[v.getId()]); } else { check.setChecked(true); networksToShow.add(historyNetworks[v.getId()]); } System.out.println(networksToShow.toString()); } }); networkListView.addView(singleItemLayout); final View divider = new View(activity); layout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv); divider.setBackgroundResource(R.drawable.bg_trans_light_10); networkListView.addView(divider, layout); } networkListView.invalidate(); } /* * // Set option as Multiple Choice. So that user can able to select * more the one option from list deviceListView.setAdapter(new * ArrayAdapter<String>(activity, * android.R.layout.simple_list_item_multiple_choice, historyDevices)); * deviceListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); * * for (int i = 0; i < historyDevices.length; i++) { * //deviceListView.setItemChecked(i, true); } * * deviceListView.setOnItemClickListener(new OnItemClickListener() { * * @Override public void onItemClick(AdapterView<?> l, View v, int * position, long id) { * * } * * }); * * * // Set option as Multiple Choice. So that user can able to select * more the one option from list networkListView.setAdapter(new * ArrayAdapter<String>(activity, * android.R.layout.simple_list_item_multiple_choice, networkDevices)); * networkListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); * * for (int i = 0; i < networkDevices.length; i++) { * networkListView.setItemChecked(i, true); } * * SparseBooleanArray checked = * deviceListView.getCheckedItemPositions(); ArrayList<String> * devicesToShow = new ArrayList<String>(); for(int i = 0; i < * checked.size()+1; i++){ if(checked.get(i)) * devicesToShow.add(historyDevices[i]); } */ return view; }
From source file:com.qs.qswlw.view.Mypager.UltraViewPagerIndicator.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (viewPager == null || viewPager.getAdapter() == null) return;/*from ww w. ja v a 2 s . c o m*/ final int count = ((UltraViewPagerAdapter) viewPager.getAdapter()).getRealCount(); if (count == 0) return; int longSize; int shortSize; int longPaddingBefore; int longPaddingAfter; int shortPaddingBefore; int shortPaddingAfter; if (orientation == UltraViewPager.Orientation.HORIZONTAL) { longSize = viewPager.getWidth(); shortSize = viewPager.getHeight(); longPaddingBefore = (int) (getItemWidth() + getPaddingLeft() + marginLeft); longPaddingAfter = getPaddingRight() + marginRight; shortPaddingBefore = (int) (getItemWidth() + getPaddingTop() + marginTop); shortPaddingAfter = (int) paintStroke.getStrokeWidth() + getPaddingBottom() + marginBottom; } else { longSize = viewPager.getHeight(); shortSize = viewPager.getWidth(); longPaddingBefore = (int) (getItemWidth() + getPaddingTop() + marginTop); longPaddingAfter = (int) paintStroke.getStrokeWidth() + getPaddingBottom() + marginBottom; shortPaddingBefore = (int) (getItemWidth() + getPaddingLeft() + marginLeft); shortPaddingAfter = getPaddingRight() + marginRight; } final float itemWidth = getItemWidth(); final int widthRatio = isDrawResIndicator() ? 1 : 2; //bitmap resource X1 : circle X2 if (indicatorPadding == 0) { indicatorPadding = (int) itemWidth; } float shortOffset = shortPaddingBefore; float longOffset = longPaddingBefore; final float indicatorLength = count * itemWidth * widthRatio + (count - 1) * indicatorPadding; final int horizontalGravityMask = gravity & Gravity.HORIZONTAL_GRAVITY_MASK; final int verticalGravityMask = gravity & Gravity.VERTICAL_GRAVITY_MASK; switch (horizontalGravityMask) { case Gravity.CENTER_HORIZONTAL: longOffset = (longSize - longPaddingBefore - longPaddingAfter - indicatorLength) / 2.0f; break; case Gravity.RIGHT: if (orientation == UltraViewPager.Orientation.HORIZONTAL) { longOffset = longSize - longPaddingAfter - indicatorLength; } if (orientation == UltraViewPager.Orientation.VERTICAL) { shortOffset = shortSize - shortPaddingAfter - itemWidth; } break; case Gravity.LEFT: default: break; } switch (verticalGravityMask) { case Gravity.CENTER_VERTICAL: shortOffset = (shortSize - shortPaddingAfter - shortPaddingBefore - itemWidth) / 2; break; case Gravity.BOTTOM: if (orientation == UltraViewPager.Orientation.HORIZONTAL) { shortOffset = shortSize - shortPaddingAfter - getItemHeight(); } if (orientation == UltraViewPager.Orientation.VERTICAL) { longOffset = longSize - longPaddingAfter - indicatorLength; } break; case Gravity.TOP: default: break; } if (horizontalGravityMask == Gravity.CENTER_HORIZONTAL && verticalGravityMask == Gravity.CENTER_VERTICAL) { shortOffset = (shortSize - shortPaddingAfter - shortPaddingBefore - itemWidth) / 2; } float dX; float dY; float pageFillRadius = radius; if (paintStroke.getStrokeWidth() > 0) { pageFillRadius -= paintStroke.getStrokeWidth() / 2.0f; //TODO may not/2 } //Draw stroked circles for (int iLoop = 0; iLoop < count; iLoop++) { float drawLong = longOffset + (iLoop * (itemWidth * widthRatio + indicatorPadding)); if (orientation == UltraViewPager.Orientation.HORIZONTAL) { dX = drawLong; dY = shortOffset; } else { dX = shortOffset; dY = drawLong; } if (isDrawResIndicator()) { if (iLoop == viewPager.getCurrentItem()) continue; canvas.drawBitmap(normalBitmap, dX, dY, paintFill); } else { // Only paint fill if not completely transparent if (paintFill.getAlpha() > 0) { paintFill.setColor(normalColor); canvas.drawCircle(dX, dY, pageFillRadius, paintFill); } // Only paint stroke if a stroke width was non-zero if (pageFillRadius != radius) { canvas.drawCircle(dX, dY, radius, paintStroke); } } } //Draw the filled circle according to the current scroll float cx = (viewPager.getCurrentItem()) * (itemWidth * widthRatio + indicatorPadding); if (animateIndicator) cx += pageOffset * itemWidth; if (orientation == UltraViewPager.Orientation.HORIZONTAL) { dX = longOffset + cx; dY = shortOffset; } else { dX = shortOffset; dY = longOffset + cx; } if (isDrawResIndicator()) { canvas.drawBitmap(focusBitmap, dX, dY, paintStroke); } else { paintFill.setColor(focusColor); canvas.drawCircle(dX, dY, radius, paintFill); } }
From source file:kookmin.cs.sympathymusiz.VideoListDemoActivity.java
/** * Sets up the layout programatically for the three different states. Portrait, landscape or * fullscreen+landscape. This has to be done programmatically because we handle the orientation * changes ourselves in order to get fluent fullscreen transitions, so the xml layout resources * do not get reloaded./*www.j av a 2 s . c o m*/ */ private void layout() { boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; //ArrayList<ArrayList<String>> list = (ArrayList<ArrayList<String>>) getIntent("exIntent""); listFragment.getView().setVisibility(isFullscreen ? View.GONE : View.VISIBLE); listFragment.setLabelVisibility(isPortrait); closeButton.setVisibility(isPortrait ? View.VISIBLE : View.GONE); if (isFullscreen) { videoBox.setTranslationY(0); // Reset any translation that was applied in portrait. setLayoutSize(videoFragment.getView(), MATCH_PARENT, MATCH_PARENT); setLayoutSizeAndGravity(videoBox, MATCH_PARENT, MATCH_PARENT, Gravity.TOP | Gravity.LEFT); } else if (isPortrait) { setLayoutSize(listFragment.getView(), MATCH_PARENT, MATCH_PARENT); setLayoutSize(videoFragment.getView(), MATCH_PARENT, WRAP_CONTENT); setLayoutSizeAndGravity(videoBox, MATCH_PARENT, WRAP_CONTENT, Gravity.BOTTOM); } else { videoBox.setTranslationY(0); // Reset any translation that was applied in portrait. int screenWidth = dpToPx(getResources().getConfiguration().screenWidthDp); setLayoutSize(listFragment.getView(), screenWidth / 4, MATCH_PARENT); int videoWidth = screenWidth - screenWidth / 4 - dpToPx(LANDSCAPE_VIDEO_PADDING_DP); setLayoutSize(videoFragment.getView(), videoWidth, WRAP_CONTENT); setLayoutSizeAndGravity(videoBox, videoWidth, WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL); } }