List of usage examples for android.widget RelativeLayout TRUE
int TRUE
To view the source code for android.widget RelativeLayout TRUE.
Click Source Link
From source file:net.xisberto.work_schedule.PeriodListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.period_list_item, null); }//from w ww .jav a 2 s . c om final Period period = (Period) getItem(position); ((TextView) convertView.findViewById(R.id.period_label)).setText(context.getString(period.getLabelId())); ((TextView) convertView.findViewById(R.id.period_time)) .setText(period.formatTime(DateFormat.is24HourFormat(context))); CompoundButton check_alarm = (CompoundButton) convertView.findViewById(R.id.check_alarm); if (show_checkboxes) { check_alarm.setChecked(period.enabled); check_alarm.setOnClickListener(new OnClickListener() { @Override public void onClick(View check_box) { boolean isChecked = ((CompoundButton) check_box).isChecked(); period.enabled = isChecked && (period.time.getTimeInMillis() > System.currentTimeMillis()); period.setAlarm(context, true); period.persist(context); ((CompoundButton) check_box).setChecked(period.enabled); } }); } else { check_alarm.setVisibility(View.GONE); LinearLayout layout_labels = (LinearLayout) convertView.findViewById(R.id.layout_labels); LayoutParams params = (LayoutParams) layout_labels.getLayoutParams(); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layout_labels.setLayoutParams(params); } return convertView; }
From source file:com.qs.qswlw.view.Mypager.UltraViewPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { int realPosition = position; //TODO/*from w ww. j av a 2 s .c o m*/ if (enableLoop && adapter.getCount() != 0) { realPosition = position % adapter.getCount(); } Object item = adapter.instantiateItem(container, realPosition); //TODO View childView = null; if (item instanceof View) childView = (View) item; // if (item instanceof RecyclerView.ViewHolder) // childView = ((RecyclerView.ViewHolder) item).itemView; ViewPager viewPager = (ViewPager) container; int childCount = viewPager.getChildCount(); for (int i = 0; i < childCount; i++) { View child = viewPager.getChildAt(i); if (isViewFromObject(child, item)) { viewArray.put(realPosition, child); break; } } if (isEnableMultiScr()) { if (scrWidth == 0) { scrWidth = container.getResources().getDisplayMetrics().widthPixels; } RelativeLayout relativeLayout = new RelativeLayout(container.getContext()); if (childView.getLayoutParams() != null) { RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( (int) (scrWidth * multiScrRatio), ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); childView.setLayoutParams(layoutParams); } container.removeView(childView); relativeLayout.addView(childView); container.addView(relativeLayout); return relativeLayout; } return item; }
From source file:com.tmall.ultraviewpager.UltraViewPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { int realPosition = position; //TODO/*from w w w . j av a2 s . co m*/ if (enableLoop && adapter.getCount() != 0) { realPosition = position % adapter.getCount(); } Object item = adapter.instantiateItem(container, realPosition); //TODO View childView = null; if (item instanceof View) childView = (View) item; if (item instanceof RecyclerView.ViewHolder) childView = ((RecyclerView.ViewHolder) item).itemView; ViewPager viewPager = (ViewPager) container; int childCount = viewPager.getChildCount(); for (int i = 0; i < childCount; i++) { View child = viewPager.getChildAt(i); if (isViewFromObject(child, item)) { viewArray.put(realPosition, child); break; } } if (isEnableMultiScr()) { if (scrWidth == 0) { scrWidth = container.getResources().getDisplayMetrics().widthPixels; } RelativeLayout relativeLayout = new RelativeLayout(container.getContext()); if (childView.getLayoutParams() != null) { RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( (int) (scrWidth * multiScrRatio), ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); childView.setLayoutParams(layoutParams); } container.removeView(childView); relativeLayout.addView(childView); container.addView(relativeLayout); return relativeLayout; } return item; }
From source file:dhbk.android.spotifygcs.ui.fab.FABRevealLayout.java
private void setupFABPosition() { LayoutParams params = (LayoutParams) fab.getLayoutParams(); params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { params.rightMargin = dipsToPixels(16); params.topMargin = dipsToPixels(20); }/* ww w . j a v a 2 s .c o m*/ fab.bringToFront(); }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void setupFABPosition() { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) fab.getLayoutParams(); params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { params.rightMargin = dipsToPixels(16); params.topMargin = dipsToPixels(20); }//w w w . j a v a2 s .c om fab.bringToFront(); }
From source file:com.androidhiddencamera.HiddenCameraFragment.java
/** * Add camera preview to the root of the activity layout. * * @return {@link CameraPreview} that was added to the view. *//*ww w .j a va2 s . co m*/ private CameraPreview addPreView() { //create fake camera view CameraPreview cameraSourceCameraPreview = new CameraPreview(getActivity(), this); cameraSourceCameraPreview.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); View view = ((ViewGroup) getActivity().getWindow().getDecorView().getRootView()).getChildAt(0); if (view instanceof LinearLayout) { LinearLayout linearLayout = (LinearLayout) view; LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(1, 1); linearLayout.addView(cameraSourceCameraPreview, params); } else if (view instanceof RelativeLayout) { RelativeLayout relativeLayout = (RelativeLayout) view; RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1, 1); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); relativeLayout.addView(cameraSourceCameraPreview, params); } else if (view instanceof FrameLayout) { FrameLayout frameLayout = (FrameLayout) view; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(1, 1); frameLayout.addView(cameraSourceCameraPreview, params); } else { throw new RuntimeException("Root view of the activity/fragment cannot be frame layout"); } return cameraSourceCameraPreview; }
From source file:org.orange.querysystem.content.TabsAdapter.java
private void setTabForIfLowerThanHONEYCOMB() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { View child = mTabHost.getTabWidget().getChildAt(getCount() - 1); child.setBackgroundColor(0xFFB5E61D); TextView tv = (TextView) child.findViewById(android.R.id.title); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tv.getLayoutParams(); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); //?? params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); //? params.setMargins(dp2px(10), dp2px(4), dp2px(10), dp2px(4)); child.getLayoutParams().height = RelativeLayout.LayoutParams.WRAP_CONTENT; }// www . ja v a 2 s .c om }
From source file:com.androidhiddencamera.HiddenCameraActivity.java
/** * Add camera preview to the root of the activity layout. * * @return {@link CameraPreview} that was added to the view. *//*from ww w .ja v a2 s . c o m*/ private CameraPreview addPreView() { //create fake camera view CameraPreview cameraSourceCameraPreview = new CameraPreview(this, this); cameraSourceCameraPreview.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); View view = ((ViewGroup) getWindow().getDecorView().getRootView()).getChildAt(0); if (view instanceof LinearLayout) { LinearLayout linearLayout = (LinearLayout) view; LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(1, 1); linearLayout.addView(cameraSourceCameraPreview, params); } else if (view instanceof RelativeLayout) { RelativeLayout relativeLayout = (RelativeLayout) view; RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1, 1); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); relativeLayout.addView(cameraSourceCameraPreview, params); } else if (view instanceof FrameLayout) { FrameLayout frameLayout = (FrameLayout) view; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(1, 1); frameLayout.addView(cameraSourceCameraPreview, params); } else { throw new RuntimeException("Root view of the activity/fragment cannot be frame layout"); } return cameraSourceCameraPreview; }
From source file:com.bangqu.eshow.view.sliding.ESSlidingPlayView.java
/** * ???View./*from w w w. jav a2 s. com*/ * * @param context the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new ESInnerViewPager(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 LinearLayout.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, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new ESViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int 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:cn.org.eshow.framwork.view.sliding.AbSlidingPlayView.java
/** * ???View./*from ww w. ja v a2 s .co m*/ * * @param context the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LinearLayout.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 LinearLayout.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, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }