Java Code Examples for android.widget.RelativeLayout#getContext()
The following examples show how to use
android.widget.RelativeLayout#getContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageViewSensorAnimationBehavior.java From science-journal with Apache License 2.0 | 6 votes |
@Override public void initializeLargeIcon(RelativeLayout layout, @Nullable Double value) { // Remove previous views. if (layout.getChildCount() > 0) { layout.removeAllViews(); } ImageView largeIcon = new ImageView(layout.getContext()); layout.addView( largeIcon, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); largeIcon.setImageDrawable(getLevelDrawable(largeIcon.getContext())); largeIcon.setRotation(0.0f); // Icon level depends on type -- we want to pick something in the middle to look reasonable. if (behaviorType == TYPE_ACCELEROMETER_SCALE || behaviorType == TYPE_ACCELEROMETER_SCALE_ROTATES) { // Pick the middle icon largeIcon.setImageLevel(2); } else if (behaviorType == TYPE_POSITIVE_RELATIVE_SCALE || behaviorType == TYPE_RELATIVE_SCALE) { // Pick the most exciting icon (the biggest value represented) largeIcon.setImageLevel(3); } }
Example 2
Source File: VideoViewManager.java From sealrtc-android with MIT License | 5 votes |
RenderHolder(RelativeLayout containerLayout, int index) { this.containerLayout = containerLayout; this.containerLayout.setOnTouchListener(this); this.gestureDetector = new GestureDetector(containerLayout.getContext(), this); this.containerLayout.setBackgroundColor( VideoViewManager.this.context.getResources().getColor(R.color.blink_blue)); targetZindex = index; }
Example 3
Source File: ScrollerPager.java From AdPlayBanner with Apache License 2.0 | 5 votes |
public ScrollerPager(RelativeLayout mContainer, TitleView mTitleView, List<AdPageInfo> infos) { super(mContainer.getContext()); this.mContainer = mContainer; this.mTitleView = mTitleView; if (null != infos) { this.mDataList = infos; } else { this.mDataList = new ArrayList<>(); } init(); }
Example 4
Source File: PitchSensorAnimationBehavior.java From science-journal with Apache License 2.0 | 5 votes |
@Override public void initializeLargeIcon(RelativeLayout layout, @Nullable Double value) { // Remove previous views. if (layout.getChildCount() > 0) { layout.removeAllViews(); } Context context = layout.getContext(); ImageViewCanvas largeIcon = new ImageViewCanvas(context); layout.addView( largeIcon, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); largeIcon.setImageDrawable( context.getResources().getDrawable(R.drawable.sound_frequency_drawable)); largeIcon.setPitch((value != null) ? value : 0); }
Example 5
Source File: ClassicConfig.java From SmoothRefreshLayout with MIT License | 4 votes |
static void createClassicViews(RelativeLayout layout) { TextView textViewTitle = new TextView(layout.getContext()); textViewTitle.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_title); textViewTitle.setTextSize(12); textViewTitle.setTextColor(Color.parseColor("#333333")); TextView textViewLastUpdate = new TextView(layout.getContext()); textViewLastUpdate.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_last_update); textViewLastUpdate.setTextSize(10); textViewLastUpdate.setTextColor(Color.parseColor("#969696")); textViewLastUpdate.setVisibility(View.GONE); LinearLayout textContainer = new LinearLayout(layout.getContext()); textContainer.setOrientation(LinearLayout.VERTICAL); textContainer.setGravity(Gravity.CENTER_HORIZONTAL); textContainer.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_text_container); LinearLayout.LayoutParams textViewTitleLP = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); textContainer.addView(textViewTitle, textViewTitleLP); LinearLayout.LayoutParams textViewLastUpdateLP = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); textContainer.addView(textViewLastUpdate, textViewLastUpdateLP); RelativeLayout.LayoutParams textContainerLP = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); textContainerLP.addRule(RelativeLayout.CENTER_IN_PARENT); layout.addView(textContainer, textContainerLP); ImageView imageViewArrow = new ImageView(layout.getContext()); imageViewArrow.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_arrow); RelativeLayout.LayoutParams imageViewArrowLP = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); final int dp6 = PixelUtl.dp2px(layout.getContext(), 6); imageViewArrowLP.setMargins(dp6, dp6, dp6, dp6); imageViewArrowLP.addRule( RelativeLayout.LEFT_OF, me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_text_container); imageViewArrowLP.addRule(RelativeLayout.CENTER_VERTICAL); layout.addView(imageViewArrow, imageViewArrowLP); ProgressBar progressBar = new ProgressBar( layout.getContext(), null, android.R.attr.progressBarStyleSmallInverse); progressBar.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_progress); RelativeLayout.LayoutParams progressBarLP = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); progressBarLP.setMargins(dp6, dp6, dp6, dp6); progressBarLP.addRule( RelativeLayout.LEFT_OF, me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_text_container); progressBarLP.addRule(RelativeLayout.CENTER_VERTICAL); layout.addView(progressBar, progressBarLP); }
Example 6
Source File: BasicTabSwitcher.java From Cornowser with MIT License | 4 votes |
public BasicTabSwitcher(RelativeLayout rootView) { this(rootView.getContext(), rootView); }