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

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

源代码1 项目: imsdk-android   文件: TreeNodeWrapperView.java
private void init() {
    setOrientation(LinearLayout.VERTICAL);

    nodeContainer = new RelativeLayout(getContext());
    nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeContainer.setId(R.id.node_header);

    ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
    nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
    nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeItemsContainer.setId(R.id.node_items);
    nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
    nodeItemsContainer.setVisibility(View.GONE);

    addView(nodeContainer);
    addView(nodeItemsContainer);
}
 
private void init() {
    setOrientation(LinearLayout.VERTICAL);

    nodeContainer = new RelativeLayout(getContext());
    nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeContainer.setId(R.id.node_header);

    ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
    nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
    nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeItemsContainer.setId(R.id.node_items);
    nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
    nodeItemsContainer.setVisibility(View.GONE);

    addView(nodeContainer);
    addView(nodeItemsContainer);
}
 
private View getEraseView(Context context) {
    GridLayout.LayoutParams params = new GridLayout.LayoutParams();
    params.setGravity(Gravity.FILL);
    params.rowSpec = GridLayout.spec(GridLayout.UNDEFINED, 1f);
    params.columnSpec = GridLayout.spec(GridLayout.UNDEFINED, 1f);

    RelativeLayout relativeLayout = new RelativeLayout(context);
    relativeLayout.setLayoutParams(params);
    relativeLayout.setGravity(Gravity.CENTER);
    relativeLayout.setBackground(context.getResources().getDrawable(R.drawable.ripple));
    relativeLayout.setId(R.id.input_erase);

    ImageView eraseView = new ImageView(context);
    eraseView.setImageResource(R.drawable.ic_erase);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    eraseView.setLayoutParams(layoutParams);

    relativeLayout.addView(eraseView);
    relativeLayout.setOnClickListener(this);
    return relativeLayout;
}
 
源代码4 项目: AndroidQuick   文件: TreeNodeWrapperView.java
private void init() {
    setOrientation(LinearLayout.VERTICAL);

    nodeContainer = new RelativeLayout(getContext());
    nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeContainer.setId(R.id.node_header);

    ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
    nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
    nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeItemsContainer.setId(R.id.node_items);
    nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
    nodeItemsContainer.setVisibility(View.GONE);

    addView(nodeContainer);
    addView(nodeItemsContainer);
}
 
源代码5 项目: javaide   文件: TreeNodeWrapperView.java
private void init() {
    setOrientation(LinearLayout.VERTICAL);

    nodeContainer = new RelativeLayout(getContext());
    nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeContainer.setId(R.id.node_header);

    ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
    nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
    nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeItemsContainer.setId(R.id.node_items);
    nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
    nodeItemsContainer.setVisibility(View.GONE);

    addView(nodeContainer);
    addView(nodeItemsContainer);
}
 
源代码6 项目: AndroidTreeView   文件: TreeNodeWrapperView.java
private void init() {
    setOrientation(LinearLayout.VERTICAL);

    nodeContainer = new RelativeLayout(getContext());
    nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeContainer.setId(R.id.node_header);

    ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
    nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
    nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    nodeItemsContainer.setId(R.id.node_items);
    nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
    nodeItemsContainer.setVisibility(View.GONE);

    addView(nodeContainer);
    addView(nodeItemsContainer);
}
 
源代码7 项目: ChatMessageView   文件: ChatMessageView.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void initContent() {
    arrowImage = new ImageView(getContext());
    arrowImage.setId(ViewUtil.generateViewId());

    containerLayout = new RelativeLayout(getContext());
    containerLayout.setId(ViewUtil.generateViewId());

    setShowArrow(showArrow);
    setContentPadding((int) contentPadding);

    super.addView(arrowImage, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    super.addView(containerLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    updatePositionAndGravity();

    updateColors();
    this.setClickable(true);
}
 
源代码8 项目: DropDownMenu   文件: FixedTabIndicator.java
/**
 * 直接用TextView使用weight不能控制图片,需要用用父控件包裹
 */
private View generateTextView(String title, int pos) {
    // 子空间TextView
    TextView tv = new TextView(context);
    tv.setGravity(Gravity.CENTER);
    tv.setText(title);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTabTextSize);
    tv.setTextColor(mTabDefaultColor);
    tv.setSingleLine();
    tv.setEllipsize(TextUtils.TruncateAt.END);
    tv.setMaxEms(6);//限制4个字符
    Drawable drawable = getResources().getDrawable(R.drawable.level_filter);
    tv.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
    tv.setCompoundDrawablePadding(drawableRight);

    // 将TextView添加到父控件RelativeLayout
    RelativeLayout rl = new RelativeLayout(context);
    RelativeLayout.LayoutParams rlParams = new RelativeLayout.LayoutParams(-2, -2);
    rlParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    rl.addView(tv, rlParams);
    rl.setId(pos);

    // 再将RelativeLayout添加到LinearLayout中
    LayoutParams params = new LayoutParams(-1, -1);
    params.weight = 1;
    params.gravity = Gravity.CENTER;
    rl.setLayoutParams(params);

    rl.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // 设置点击事件
            switchTab(v.getId());
        }
    });

    return rl;
}
 
源代码9 项目: commcare-android   文件: MediaLayout.java
private void setAVT(TextView text, String audioURI, String imageURI,
                    final String videoURI, final String bigImageURI,
                    final String qrCodeContent, String inlineVideoURI,
                    boolean showImageAboveText,
                    int questionIndex) {
    viewText = text;
    mInlineVideoUri = inlineVideoURI;
    mImageURI = imageURI;
    mBigImageURI = bigImageURI;
    mQrCodeContent = qrCodeContent;

    RelativeLayout questionTextPane = new RelativeLayout(this.getContext());
    questionTextPane.setId(QUESTION_TEXT_PANE_ID);

    setupStandardAudio(audioURI, questionIndex);
    setupVideoButton(videoURI);

    // Now set up the center view -- it is either an image, a QR Code, an inline video, or
    // expanded audio
    mediaPane = new RelativeLayout(getContext());

    LayoutParams mediaPaneParams = refreshMediaView();

    addAudioVideoButtonsToView(questionTextPane);

    showImageAboveText = showImageAboveText || DeveloperPreferences.imageAboveTextEnabled();
    addElementsToView(mediaPane, mediaPaneParams, questionTextPane, showImageAboveText);
}
 
源代码10 项目: Auie   文件: UIFlexListView.java
/**
 * 构建内容视图
 */
private void createContentView() {
	mContentLayout = new RelativeLayout(getContext());
	mContentLayout.setId(1992);
	mContentLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	mHeaderView = new FrameLayout(getContext());
	mHeaderView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.MATCH_PARENT));
	mHeaderView.setBackgroundColor(Color.WHITE);
	mHeaderView.setPadding(0, headerHeight, 0, 0);
	mListView = new UIListView(getContext());
	mListView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	mListView.setType(UIListView.TYPE_NONE);
	mListView.addHeaderView(mHeaderView);
	mListView.setBackgroundColor(Color.WHITE);
	mListView.setOnScrollListener(this);
	mHeaderLayout = new LinearLayout(getContext());
	mHeaderLayout.setOrientation(LinearLayout.VERTICAL);
	mHeaderLayout.setBackgroundColor(Color.WHITE);
	mHeaderLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	mHeaderLayout.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
		@Override
		public void onGlobalLayout() {
			headerHeight = mHeaderLayout.getHeight();
			resetHeaderView(headerHeight);
		}
	});
	mHeaderContentLayout = new LinearLayout(getContext());
	mHeaderContentLayout.setOrientation(LinearLayout.VERTICAL);
	mHeaderContentLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	mHeaderActionBarLayout = new LinearLayout(getContext());
	mHeaderActionBarLayout.setBackgroundColor(Color.GRAY);
	mHeaderActionBarLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	mHeaderLayout.addView(mHeaderContentLayout);
	mHeaderLayout.addView(mHeaderActionBarLayout);
	mContentLayout.addView(mListView);
	addView(mContentLayout);
	addView(mHeaderLayout);
}
 
源代码11 项目: MaterialBanner   文件: Banner.java
private void initViewGroup(Context context) {
    // CONTENT CONTAINER
    LayoutParams layoutParams = new LayoutParams(MATCH_PARENT, WRAP_CONTENT);

    mContentContainer = new RelativeLayout(context);
    mContentContainer.setId(R.id.mb_container_content);
    mContentContainer.setLayoutParams(layoutParams);

    // ICON VIEW
    RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(
            mIconSize, mIconSize);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        relativeLayoutParams.setMarginStart(mIconMarginStart);
        relativeLayoutParams.addRule(ALIGN_PARENT_START, TRUE);
    } else {
        relativeLayoutParams.leftMargin = mIconMarginStart;
        relativeLayoutParams.addRule(ALIGN_PARENT_LEFT, TRUE);
    }

    mIconView = new AppCompatImageView(context);
    mIconView.setId(R.id.mb_icon);
    mIconView.setLayoutParams(relativeLayoutParams);
    mIconView.setVisibility(GONE);

    // MESSAGE VIEW
    relativeLayoutParams = new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        relativeLayoutParams.setMarginStart(mMessageMarginStart);
        relativeLayoutParams.addRule(ALIGN_PARENT_START, TRUE);
    } else {
        relativeLayoutParams.leftMargin = mMessageMarginStart;
        relativeLayoutParams.addRule(ALIGN_PARENT_LEFT, TRUE);
    }

    mMessageView = new MessageView(context);
    mMessageView.setId(R.id.mb_message);
    mMessageView.setLayoutParams(relativeLayoutParams);

    // BUTTONS CONTAINER
    relativeLayoutParams = new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        relativeLayoutParams.addRule(ALIGN_PARENT_END, TRUE);
    } else {
        relativeLayoutParams.addRule(ALIGN_PARENT_RIGHT, TRUE);
    }

    mButtonsContainer = new ButtonsContainer(context);
    mButtonsContainer.setId(R.id.mb_container_buttons);
    mButtonsContainer.setLayoutParams(relativeLayoutParams);

    mLeftButton = mButtonsContainer.getLeftButton();
    mRightButton = mButtonsContainer.getRightButton();

    // LINE
    layoutParams = new LayoutParams(MATCH_PARENT, mLineHeight);

    mLine = new View(context);
    mLine.setId(R.id.mb_line);
    mLine.setLayoutParams(layoutParams);

    addView(mContentContainer);
    addView(mLine);

    mContentContainer.addView(mIconView);
    mContentContainer.addView(mMessageView);
    mContentContainer.addView(mButtonsContainer);
}
 
源代码12 项目: Leanplum-Android-SDK   文件: BaseMessageDialog.java
protected BaseMessageDialog(Activity activity, boolean fullscreen, BaseMessageOptions options,
    WebInterstitialOptions webOptions, HTMLOptions htmlOptions) {
  super(activity, getTheme(activity));

  SizeUtil.init(activity);
  this.activity = activity;
  this.options = options;
  this.webOptions = webOptions;
  this.htmlOptions = htmlOptions;
  if (webOptions != null) {
    isWeb = true;
  }
  if (htmlOptions != null) {
    isHtml = true;
  }
  dialogView = new RelativeLayout(activity);
  RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
      LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  dialogView.setBackgroundColor(Color.TRANSPARENT);
  dialogView.setLayoutParams(layoutParams);

  RelativeLayout view = createContainerView(activity, fullscreen);
  view.setId(R.id.container_view);
  dialogView.addView(view, view.getLayoutParams());

  if ((!isWeb || (webOptions != null && webOptions.hasDismissButton())) && !isHtml) {
    CloseButton closeButton = createCloseButton(activity, fullscreen, view);
    dialogView.addView(closeButton, closeButton.getLayoutParams());
  }
  setContentView(dialogView, dialogView.getLayoutParams());

  dialogView.setAnimation(createFadeInAnimation());

  if (!fullscreen) {
    Window window = getWindow();
    if (window == null) {
      return;
    }
    if (!isHtml) {
      window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
      if (Build.VERSION.SDK_INT >= 14) {
        window.setDimAmount(0.7f);
      }
    } else {
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

      if (htmlOptions != null && isBannerWithTapOutsideFalse(htmlOptions)) {
        // banners need to be positioned at the top manually
        // (unless they get repositioned to the bottom later)
        window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        window.setGravity(Gravity.TOP);

        // use the html y offset to determine the y location of the window; this is different
        // from non-banners because we don't want to make the window too big (e.g. via a margin
        // in the layout) and block other things on the screen (e.g. dialogs)
        WindowManager.LayoutParams windowLayoutParams = window.getAttributes();
        windowLayoutParams.y = htmlOptions.getHtmlYOffset(activity);
        window.setAttributes(windowLayoutParams);

        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
      } else {
        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
      }

      if (htmlOptions != null &&
          MessageTemplates.Args.HTML_ALIGN_BOTTOM.equals(htmlOptions.getHtmlAlign())) {
        if (isBannerWithTapOutsideFalse(htmlOptions)) {
          window.setGravity(Gravity.BOTTOM);
        } else {
          dialogView.setGravity(Gravity.BOTTOM);
        }
      }
    }
  }
}
 
源代码13 项目: MaterialDrawer-Xamarin   文件: DrawerBuilder.java
/**
 * Call this method to append a new DrawerBuilder to a existing Drawer.
 *
 * @param result the Drawer.Result of an existing Drawer
 * @return
 */
public Drawer append(@NonNull Drawer result) {
    if (mUsed) {
        throw new RuntimeException("you must not reuse a DrawerBuilder builder");
    }
    if (mDrawerGravity == null) {
        throw new RuntimeException("please set the gravity for the drawer");
    }

    //set that this builder was used. now you have to create a new one
    mUsed = true;
    mAppended = true;

    //get the drawer layout from the previous drawer
    mDrawerLayout = result.getDrawerLayout();

    // get the slider view
    mSliderLayout = (RelativeLayout) mActivity.getLayoutInflater().inflate(R.layout.material_drawer_slider, mDrawerLayout, false);
    mSliderLayout.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background));
    // get the layout params
    DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mSliderLayout.getLayoutParams();
    // set the gravity of this drawerGravity
    params.gravity = mDrawerGravity;
    // if this is a drawer from the right, change the margins :D
    params = DrawerUtils.processDrawerLayoutParams(this, params);
    // set the new params
    mSliderLayout.setLayoutParams(params);
    //define id for the sliderLayout
    mSliderLayout.setId(R.id.material_drawer_slider_layout);
    // add the slider to the drawer
    mDrawerLayout.addView(mSliderLayout, 1);

    //create the content
    createContent();

    //create the result object
    Drawer appendedResult = new Drawer(this);

    //toggle selection list if we were previously on the account list
    if (mSavedInstance != null && mSavedInstance.getBoolean(Drawer.BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED, false)) {
        mAccountHeader.toggleSelectionList(mActivity);
    }

    //forget the reference to the activity
    mActivity = null;

    return appendedResult;
}
 
源代码14 项目: appcan-android   文件: EBounceViewHeader.java
public EBounceViewHeader(Context context, int type) {
    super(context);
    setWillNotDraw(true);
    setBackgroundColor(0);
    setFocusable(false);
    ESystemInfo intence = ESystemInfo.getIntence();
    int height = intence.mDefaultBounceHeight;
    RelativeLayout wapper = new RelativeLayout(context);
    wapper.setWillNotDraw(true);
    wapper.setBackgroundColor(0);
    wapper.setFocusable(false);
    RelativeLayout.LayoutParams wParm = new LayoutParams(-1, height);
    if (type == EViewEntry.F_BOUNCE_TYPE_TOP) {
        wParm.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    } else {
        wParm.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    }
    wapper.setLayoutParams(wParm);
    addView(wapper);

    wap = new RelativeLayout(context);
    wap.setId(F_WAP_ID);
    RelativeLayout.LayoutParams wm = new LayoutParams(-2, height);
    wm.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    wm.leftMargin = 30;
    wap.setLayoutParams(wm);

    mContent = new TextView(context);
    mContent.setId(F_CONTENT_ID);
    RelativeLayout.LayoutParams parmMsg = new LayoutParams(-2, -2);
    parmMsg.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mContent.setLayoutParams(parmMsg);
    mContent.setTextColor(textColor);
    mContent.setText(pullToReloadText);
    mContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) (intence.mDefaultNatvieFontSize));
    mContent.setVisibility(GONE);
    wap.addView(mContent);

    mLevelContent = new TextView(context);
    RelativeLayout.LayoutParams parml = new LayoutParams(-2, -2);
    parml.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    parml.addRule(RelativeLayout.BELOW, F_CONTENT_ID);
    mLevelContent.setLayoutParams(parml);
    mLevelContent.setTextColor(textColor);
    mLevelContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) (intence.mDefaultNatvieFontSize * 0.6));
    mLevelContent.setVisibility(GONE);
    wap.addView(mLevelContent);

    wapper.addView(wap);

    mProgress = new ProgressBar(context);
    mProgress.setIndeterminate(true);
    int use = height - 12;
    RelativeLayout.LayoutParams parmPro = new LayoutParams(use, use);
    parmPro.addRule(RelativeLayout.LEFT_OF, F_WAP_ID);
    parmPro.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mProgress.setLayoutParams(parmPro);
    mProgress.setVisibility(GONE);
    wapper.addView(mProgress);

    mYAxisProgress = new YAxisImageView(context);
    int useY = height - 12;
    RelativeLayout.LayoutParams parmProY = new LayoutParams(useY, useY);
    parmProY.addRule(RelativeLayout.LEFT_OF, F_WAP_ID);
    parmProY.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mYAxisProgress.setLayoutParams(parmProY);
    mYAxisProgress.setVisibility(GONE);
    wapper.addView(mYAxisProgress);

    mArrowImage = new ImageView(context);
    int useA = height - 12;
    RelativeLayout.LayoutParams parmImage = new LayoutParams(useA, useA);
    parmImage.addRule(RelativeLayout.LEFT_OF, F_WAP_ID);
    parmImage.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mArrowImage.setLayoutParams(parmImage);
    Drawable icon = context.getResources().getDrawable(EResources.platform_myspace_pulltorefresh_arrow);
    mArrowImage.setImageDrawable(icon);
    mArrowImage.setVisibility(GONE);
    wapper.addView(mArrowImage);

    mAnimationUp = new RotateAnimation(-180, 0,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mAnimationUp.setInterpolator(new AccelerateInterpolator());
    mAnimationUp.setDuration(250);
    mAnimationUp.setFillAfter(true);

    mAnimationDown = new RotateAnimation(0, -180,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mAnimationDown.setInterpolator(new AccelerateInterpolator());
    mAnimationDown.setDuration(250);
    mAnimationDown.setFillAfter(true);
}
 
private void init(){
	cal = Calendar.getInstance();
	base = new RelativeLayout(context);
	base.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
	base.setMinimumHeight(50);
	
	base.setId(4);
	
	LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.leftMargin = 16;
	params.topMargin = 50;
	params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	prev = new ImageView(context);
	prev.setId(1);
	prev.setLayoutParams(params);
	prev.setImageResource(R.drawable.navigation_previous_item);
	prev.setOnClickListener(this);
	base.addView(prev);
	
	params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.addRule(RelativeLayout.CENTER_HORIZONTAL);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	month = new TextView(context);
	month.setId(2);
	month.setLayoutParams(params);
	month.setTextAppearance(context, android.R.attr.textAppearanceLarge);
	month.setText(cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault())+" "+cal.get(Calendar.YEAR));
	month.setTextSize(25);
	
	base.addView(month);
	
	params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.rightMargin = 16;
	params.topMargin = 50;
	params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	next = new ImageView(context);
	next.setImageResource(R.drawable.navigation_next_item);
	next.setLayoutParams(params);
	next.setId(3);
	next.setOnClickListener(this);
	
	base.addView(next);
	
	addView(base);
	
	params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.bottomMargin = 20;
	params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
	params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	params.addRule(RelativeLayout.BELOW, base.getId());
	
	calendar = new GridView(context);
	calendar.setLayoutParams(params);
	calendar.setVerticalSpacing(4);
	calendar.setHorizontalSpacing(4);
	calendar.setNumColumns(7);
	calendar.setChoiceMode(GridView.CHOICE_MODE_SINGLE);
	calendar.setDrawSelectorOnTop(true);
	
	mAdapter = new CalendarAdapter(context,cal);
	calendar.setAdapter(mAdapter);
	calendar.setOnTouchListener(new OnTouchListener() {
		
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return calendarGesture.onTouchEvent(event);
        }
    });
	
	addView(calendar);
}