android.widget.RelativeLayout#getContext ( )源码实例Demo

下面列出了android.widget.RelativeLayout#getContext ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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);
  }
}
 
源代码2 项目: sealrtc-android   文件: VideoViewManager.java
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;
}
 
源代码3 项目: AdPlayBanner   文件: ScrollerPager.java
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();
}
 
@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);
}
 
源代码5 项目: SmoothRefreshLayout   文件: ClassicConfig.java
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);
}
 
源代码6 项目: Cornowser   文件: BasicTabSwitcher.java
public BasicTabSwitcher(RelativeLayout rootView) {
    this(rootView.getContext(), rootView);
}