Example usage for android.widget RelativeLayout BELOW

List of usage examples for android.widget RelativeLayout BELOW

Introduction

In this page you can find the example usage for android.widget RelativeLayout BELOW.

Prototype

int BELOW

To view the source code for android.widget RelativeLayout BELOW.

Click Source Link

Document

Rule that aligns a child's top edge with another child's bottom edge.

Usage

From source file:cn.org.eshow.framwork.activity.AbActivity.java

/**
 * ?????./*from  w w  w .j  ava2  s  .  c o m*/
 *
 * @param overlay the new title bar overlay
 */
public void setTitleBarOverlay(boolean overlay) {
    ab_base.removeAllViews();
    if (overlay) {
        RelativeLayout.LayoutParams layoutParamsFW1 = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParamsFW1.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
        ab_base.addView(contentLayout, layoutParamsFW1);
        RelativeLayout.LayoutParams layoutParamsFW2 = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParamsFW2.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
        ab_base.addView(mAbTitleBar, layoutParamsFW2);

        RelativeLayout.LayoutParams layoutParamsFW3 = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParamsFW3.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        ab_base.addView(mAbBottomBar, layoutParamsFW3);

    } else {
        ab_base.addView(mAbTitleBar,
                new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

        RelativeLayout.LayoutParams layoutParamsFW2 = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParamsFW2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        ab_base.addView(mAbBottomBar, layoutParamsFW2);

        RelativeLayout.LayoutParams layoutParamsFW1 = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParamsFW1.addRule(RelativeLayout.BELOW, mAbTitleBar.getId());
        layoutParamsFW1.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
        ab_base.addView(contentLayout, layoutParamsFW1);
    }
}

From source file:com.tinfoil.sms.settings.EditNumber.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.edit_number);
    setupActionBar();/*from  w w w  . j av  a 2s  .c o m*/

    dba = new DBAccessor(this);

    keyExchangeSetting = new ArrayList<RadioButton>();

    keyExchangeSetting.add((RadioButton) this.findViewById(R.id.auto_exchange));
    keyExchangeSetting.add((RadioButton) this.findViewById(R.id.manual_exchange));
    keyExchangeSetting.add((RadioButton) this.findViewById(R.id.ignore_exchange));

    phoneNumber = (EditText) findViewById(R.id.phone_number);
    sharedInfo1 = (EditText) findViewById(R.id.shared_secret_1);
    sharedInfo2 = (EditText) findViewById(R.id.shared_secret_2);
    bookPath = (EditText) findViewById(R.id.book_path);
    bookInverse = (EditText) findViewById(R.id.book_inverse);

    pubKey = (EditText) findViewById(R.id.contact_pub_key);
    boolean trusted = false;

    Intent intent = this.getIntent();

    /* Check if there is intent */
    if (intent != null) {
        /*
         * Get the extra values in the intent.
         */
        name = intent.getStringExtra(AddContact.NAME);
        originalNumber = intent.getStringExtra(AddContact.EDIT_NUMBER);
        position = intent.getIntExtra(AddContact.POSITION, AddContact.NEW_NUMBER_CODE);
        this.getIntent().removeExtra(AddContact.NAME);
        this.getIntent().removeExtra(AddContact.EDIT_NUMBER);
        this.getIntent().removeExtra(AddContact.POSITION);
    } else {
        finish();
    }

    /*
     * Is the number a new number
     */
    if (position != AddContact.NEW_NUMBER_CODE) {
        /*
         * Initialize the values to be adjusted
         */
        number = dba.getNumber(SMSUtility.format(originalNumber));

        // Number was not found in the database
        if (number == null) {
            finish();
        }

        phoneNumber.setText(originalNumber);

        sharedInfo1.setText(number.getSharedInfo1());

        sharedInfo2.setText(number.getSharedInfo2());

        bookPath.setText(number.getBookPath());

        bookInverse.setText(number.getBookInversePath());

        keyExchangeSetting.get(number.getKeyExchangeFlag()).setChecked(true);

        if (dba.isTrustedContact(originalNumber)) {
            trusted = true;
        }
    } else {
        /*
         * Initialize the values to the default values
         */
        bookPath.setText(DBAccessor.DEFAULT_BOOK_PATH);

        bookInverse.setText(DBAccessor.DEFAULT_BOOK_INVERSE_PATH);
    }

    if (trusted) {
        TextView pubKeyView = (TextView) findViewById(R.id.view_pub_key);

        sharedInfo1.setEnabled(false);
        sharedInfo2.setEnabled(false);
        phoneNumber.setEnabled(false);
        //pubKeyTitle.setVisibility(TextView.VISIBLE);
        pubKey.setVisibility(EditText.INVISIBLE);

        pubKeyView.setVisibility(TextView.VISIBLE);
        pubKeyView.setText(new String(number.getPublicKey()));

        // Find the radio button group view
        View rg = (View) findViewById(R.id.radioGroup1);

        /*
         * Set it so now it is below book_inverse since the other two
         * elements are invisible.
         */
        RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        p.addRule(RelativeLayout.BELOW, R.id.view_pub_key);
        rg.setLayoutParams(p);
    }
}

From source file:fr.cph.stock.android.activity.MainActivity.java

@Override
public void displayError(JSONObject json) {
    boolean sessionError = ((StockTrackerApp) getApplication()).isSessionError(json);
    if (sessionError) {
        ((StockTrackerApp) getApplication()).loadErrorActivity(this, json);
    } else {/*from   ww  w  .  j a v a  2  s.  c  om*/
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT,
                (int) LayoutParams.MATCH_PARENT);
        params.addRule(RelativeLayout.BELOW, errorView.getId());
        listView.setLayoutParams(params);
        errorView.setText(json.optString("error"));
        menuItem.collapseActionView();
        menuItem.setActionView(null);
    }
}

From source file:fr.cph.stock.android.activity.OverallActivity.java

@Override
public void displayError(JSONObject json) {
    Log.i(TAG, json.toString());// www. j a  va  2s.co  m
    boolean sessionError = ((StockTrackerApp) getApplication()).isSessionError(json);
    if (sessionError) {
        ((StockTrackerApp) getApplication()).loadErrorActivity(this, json);
    } else {
        errorView.setText(json.optString("error"));
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT,
                (int) LayoutParams.MATCH_PARENT);
        params.addRule(RelativeLayout.BELOW, errorView.getId());
        ListView listView = (ListView) findViewById(android.R.id.list);
        listView.setLayoutParams(params);
        refreshItem.collapseActionView();
        refreshItem.setActionView(null);
    }
}

From source file:com.ns.developer.tagview.widget.TagCloudLinkView.java

/**
 * tag draw/*from   w w  w .jav  a2 s .  c  o  m*/
 */
public void drawTags() {

    if (!mInitialized) {
        return;
    }

    // clear all tag
    removeAllViews();

    // layout padding left & layout padding right
    float total = getPaddingLeft() + getPaddingRight();
    // ???index
    int index = 1;
    // ?
    int pindex = index;

    // List Index
    int listIndex = 0;
    for (String item : mTags) {
        final int position = listIndex;
        final String tag = item;

        // inflate tag layout
        View tagLayout = (View) mInflater.inflate(R.layout.tag, null);
        tagLayout.setId(index);
        //            tagLayout.setBackgroundColor(mTagLayoutColor);

        // tag text
        TextView tagView = (TextView) tagLayout.findViewById(R.id.tag_txt);
        tagView.setText(tag);
        tagView.setPadding(INNER_VIEW_PADDING, INNER_VIEW_PADDING, INNER_VIEW_PADDING, INNER_VIEW_PADDING);
        tagView.setTextColor(mTagTextColor);
        tagView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mSelectListener != null) {
                    mSelectListener.onTagSelected(tag, position);
                }
            }
        });

        // calculateof tag layout width
        float tagWidth = tagView.getPaint().measureText(tag) + INNER_VIEW_PADDING * 2; // tagView padding (left & right)

        // deletable text
        TextView deletableView = (TextView) tagLayout.findViewById(R.id.delete_txt);
        if (mIsDeletable) {
            deletableView.setVisibility(View.VISIBLE);
            deletableView.setText(DEFAULT_DELETABLE_STRING);
            deletableView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mDeleteListener != null) {
                        String targetTag = tag;
                        TagCloudLinkView.this.remove(position);
                        mDeleteListener.onTagDeleted(targetTag, position);
                    }
                }
            });
            tagWidth += deletableView.getPaint().measureText(DEFAULT_DELETABLE_STRING) + INNER_VIEW_PADDING * 2; // deletableView Padding (left & right)
        } else {
            deletableView.setVisibility(View.GONE);
        }

        LayoutParams tagParams = new LayoutParams(HEIGHT_WC, HEIGHT_WC);
        tagParams.setMargins(0, 0, 0, 0);

        if (mWidth <= total + tagWidth + LAYOUT_WIDTH_OFFSET) {
            tagParams.addRule(RelativeLayout.BELOW, pindex);
            tagParams.topMargin = TAG_LAYOUT_TOP_MERGIN;
            // initialize total param (layout padding left & layout padding right)
            total = getPaddingLeft() + getPaddingRight();
            pindex = index;
        } else {
            tagParams.addRule(RelativeLayout.ALIGN_TOP, pindex);
            tagParams.addRule(RelativeLayout.RIGHT_OF, index - 1);
            if (index > 1) {
                tagParams.leftMargin = TAG_LAYOUT_LEFT_MERGIN;
                total += TAG_LAYOUT_LEFT_MERGIN;
            }
        }
        total += tagWidth;
        addView(tagLayout, tagParams);
        index++;
        listIndex++;
    }

    LayoutParams tagParams = new LayoutParams(HEIGHT_WC, HEIGHT_WC);
    tagParams.setMargins(0, 0, 0, 0);

    if (isAutoCompleteMode || !mIsDeletable) {
        return;
    }

    int tagWidth = 50; //25dp

    if (mWidth <= total + tagWidth + LAYOUT_WIDTH_OFFSET) {
        tagParams.addRule(RelativeLayout.BELOW, pindex);
        tagParams.topMargin = TAG_LAYOUT_TOP_MERGIN;
        // initialize total param (layout padding left & layout padding right)
        total = getPaddingLeft() + getPaddingRight();
        pindex = index;
    } else {
        tagParams.addRule(RelativeLayout.ALIGN_TOP, pindex);
        tagParams.addRule(RelativeLayout.RIGHT_OF, index - 1);
        if (index > 1) {
            tagParams.leftMargin = TAG_LAYOUT_LEFT_MERGIN;
            total += TAG_LAYOUT_LEFT_MERGIN;
        }
    }
    total += tagWidth;
    View tagLayout = (View) mInflater.inflate(R.layout.tag, null);
    addView(tagLayout, tagParams);
    tagLayout.findViewById(R.id.add_image_view).setVisibility(VISIBLE);
    tagLayout.findViewById(R.id.tag_txt).setVisibility(GONE);
    tagLayout.setClickable(true);
    tagLayout.setFocusable(true);
    tagLayout.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mAddTagListener != null) {
                mAddTagListener.onAddTag();
            }
        }
    });
    int transparentColor = ContextCompat.getColor(getContext(), android.R.color.transparent);
    tagLayout.setBackgroundColor(transparentColor);

}

From source file:fr.cph.stock.android.activity.ChartActivity.java

@Override
public void displayError(JSONObject json) {
    boolean sessionError = ((StockTrackerApp) getApplication()).isSessionError(json);
    if (sessionError) {
        ((StockTrackerApp) getApplication()).loadErrorActivity(this, json);
    } else {/* w  w w . j a v a2s.  c o m*/
        errorView.setText(json.optString("error"));
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT,
                (int) LayoutParams.MATCH_PARENT);
        params.addRule(RelativeLayout.BELOW, errorView.getId());
        WebView webView = (WebView) findViewById(R.id.webView);
        webView.setLayoutParams(params);
        menuItem.collapseActionView();
        menuItem.setActionView(null);
    }
}

From source file:com.eeshana.icstories.activities.UploadVideoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // this will copy the license file and the demo video file.
    // to the videokit work folder location.
    // without the license file the library will not work.
    //copyLicenseAndDemoFilesFromAssetsToSDIfNeeded();
    setContentView(R.layout.upload_video_activity);

    height = SignInActivity.getScreenHeight(UploadVideoActivity.this);
    width = SignInActivity.getScreenWidth(UploadVideoActivity.this);
    mProgressDialog = new ProgressDialog(UploadVideoActivity.this);
    pDialog = new ProgressDialog(UploadVideoActivity.this);
    showCustomToast = new ShowCustomToast();
    connectionDetector = new ConnectionDetector(UploadVideoActivity.this);
    //      mProgressDialog=new ProgressDialog(UploadVideoActivity.this,AlertDialog.THEME_HOLO_LIGHT);
    //      mProgressDialog.setFeatureDrawableResource(height,R.drawable.rounded_toast);
    prefs = getSharedPreferences("PREF", MODE_PRIVATE);
    regId = prefs.getString("regid", "NA");
    SharedPreferences pref = getSharedPreferences("DB", 0);
    userid = pref.getString("userid", "1");
    SharedPreferences assign_prefs = getSharedPreferences("ASSIGN", 0);
    assignment_id = assign_prefs.getString("ASSIGN_ID", "");
    videoPath = getIntent().getStringExtra("VIDEOPATH");

    //      iCTextView=(TextView) findViewById(R.id.tvIC);
    //      iCTextView.setTypeface(CaptureVideoActivity.ic_typeface,Typeface.BOLD);
    //      storiesTextView=(TextView) findViewById(R.id.tvStories);
    //      storiesTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.BOLD);
    //      watsStoryTextView=(TextView) findViewById(R.id.tvWhatsStory);
    //      watsStoryTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.ITALIC);

    //      logoImageView=(ImageView) findViewById(R.id.ivLogo);
    //      RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams((int) (width/1.9), (int) (height/9.5));
    //      lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
    //      lp.setMargins(0, 0, 0, 0);
    //      logoImageView.setLayoutParams(lp);

    uploadtTextView = (TextView) findViewById(R.id.tvUpload);
    uploadtTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    //      extension=getIntent().getStringExtra("EXTENSION");
    //      folderPath = Environment.getExternalStorageDirectory().getPath()+"/ICStoriesFolder";
    //      if (!FileUtils.checkIfFolderExists(folderPath)) {
    //         boolean isFolderCreated = FileUtils.createFolder(folderPath);
    //         Log.i(Prefs.TAG, folderPath + " created? " + isFolderCreated);
    //         if (isFolderCreated) {
    ///*from w ww. ja  v  a 2s.c o  m*/
    //         }
    //      }
    //command for rotating video 90 degree
    //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=1 -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k "+folderPath+"/out."+extension;

    //Change Video Resolution:
    //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=3 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/res."+extension;

    //command for compressing video 
    //      String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/test."+extension;
    //      setCommand(commandStr);
    //      runTranscoing();

    thumb = ThumbnailUtils.createVideoThumbnail(videoPath, MediaStore.Images.Thumbnails.MINI_KIND);
    System.out.println("THUMB IMG  in uplaod== " + thumb);

    titleEditText = (EditText) findViewById(R.id.etTitle);
    titleEditText.setTypeface(CaptureVideoActivity.stories_typeface);
    descriptionEditText = (EditText) findViewById(R.id.etDescripton);
    descriptionEditText.setTypeface(CaptureVideoActivity.stories_typeface);
    locationEditText = (EditText) findViewById(R.id.etLocation);
    locationEditText.setTypeface(CaptureVideoActivity.stories_typeface);
    isAssignmentButton = (Button) findViewById(R.id.buttonCheck);
    isAssignmentButton.setTypeface(CaptureVideoActivity.stories_typeface);
    isAssignmentButton.setOnClickListener(this);
    dailyAssignTextView = (TextView) findViewById(R.id.tvDailyAssignment);
    dailyAssignTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    uploadButton = (Button) findViewById(R.id.buttonUpload);
    uploadButton.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    RelativeLayout uploadRelativeLayout = (RelativeLayout) findViewById(R.id.rlUpload);
    RelativeLayout.LayoutParams lp9 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, height / 17);
    lp9.addRule(RelativeLayout.BELOW, R.id.rlDailyAssignment);
    lp9.setMargins(width / 7, 30, width / 7, 0);
    uploadRelativeLayout.setLayoutParams(lp9);
    uploadButton.setOnClickListener(this);

    //bottom bar

    homeRelativeLayout = (RelativeLayout) findViewById(R.id.rlHome);
    homeRelativeLayout.setBackgroundResource(R.drawable.press_border);
    homeRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    homeTextView = (TextView) homeRelativeLayout.findViewById(R.id.tvHome);
    homeTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    homeTextView.setTextColor(Color.parseColor("#fffffe"));
    RelativeLayout.LayoutParams lp4 = new RelativeLayout.LayoutParams(width / 3, width / 5);
    lp4.addRule(RelativeLayout.ALIGN_LEFT);
    homeRelativeLayout.setLayoutParams(lp4);
    homeRelativeLayout.setOnClickListener(this);

    wallRelativeLayout = (RelativeLayout) findViewById(R.id.rlWall);
    wallRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    wallTextView = (TextView) wallRelativeLayout.findViewById(R.id.tvWall);
    wallTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    RelativeLayout.LayoutParams lp5 = new RelativeLayout.LayoutParams(width / 3, width / 5);
    lp5.addRule(RelativeLayout.RIGHT_OF, R.id.rlHome);
    wallRelativeLayout.setLayoutParams(lp5);
    wallRelativeLayout.setOnClickListener(this);

    settingsRelativeLayout = (RelativeLayout) findViewById(R.id.rlSettings);
    settingsRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    settingsTextView = (TextView) settingsRelativeLayout.findViewById(R.id.tvSettings);
    settingsTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    RelativeLayout.LayoutParams lp6 = new RelativeLayout.LayoutParams(width / 3, width / 5);
    lp6.addRule(RelativeLayout.RIGHT_OF, R.id.rlWall);
    settingsRelativeLayout.setLayoutParams(lp6);
    settingsRelativeLayout.setOnClickListener(this);

    // current location
    locationDialog = new Dialog(UploadVideoActivity.this);
    locationDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    locationDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    locationDialog.setContentView(R.layout.location_dialog);
    locationDialog.setCancelable(true);
    LinearLayout dialogLayout = (LinearLayout) locationDialog.findViewById(R.id.ll1);
    okButton = (Button) dialogLayout.findViewById(R.id.OkBtn);
    okButton.setOnClickListener(this);
    cancelButton = (Button) dialogLayout.findViewById(R.id.cancelBtn);
    cancelButton.setOnClickListener(this);

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    boolean network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
    if (network_enabled) {
        locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
    } else {
        showCustomToast.showToast(UploadVideoActivity.this,
                "Could not find current location. Please enable location services of your device.");
    }
    //      else if(gps_enabled == false){
    //         locationDialog.show();
    //      }
}

From source file:com.esri.arcgisruntime.sample.editfeatureattachments.MainActivity.java

/**
 * Create a Layout for callout/*  w  w  w. j  a  v  a  2s  . c om*/
 */
private void createCallout() {

    // create content text view for the callout
    mCalloutLayout = new RelativeLayout(getApplicationContext());
    TextView calloutContent = new TextView(getApplicationContext());
    calloutContent.setId(R.id.calloutTextView);
    calloutContent.setTextColor(Color.BLACK);
    calloutContent.setTextSize(18);

    RelativeLayout.LayoutParams relativeParamsBelow = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    relativeParamsBelow.addRule(RelativeLayout.BELOW, calloutContent.getId());

    // create attachment text view for the callout
    TextView calloutAttachment = new TextView(getApplicationContext());
    calloutAttachment.setId(R.id.attchTV);
    calloutAttachment.setTextColor(Color.BLACK);
    calloutAttachment.setTextSize(13);
    calloutContent.setPadding(0, 20, 20, 0);
    calloutAttachment.setLayoutParams(relativeParamsBelow);

    RelativeLayout.LayoutParams relativeParamsRightOf = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    relativeParamsRightOf.addRule(RelativeLayout.RIGHT_OF, calloutAttachment.getId());

    // create image view for the callout
    ImageView imageView = new ImageView(getApplicationContext());
    imageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_info));
    imageView.setLayoutParams(relativeParamsRightOf);
    imageView.setOnClickListener(new ImageViewOnclickListener());

    mCalloutLayout.addView(calloutContent);
    mCalloutLayout.addView(imageView);
    mCalloutLayout.addView(calloutAttachment);

}

From source file:org.odk.collect.android.widgets.QuestionWidget.java

/**
 * Add a TextView containing the help text to the default location.
 * Override to reposition./*from   w  w w .  j  a  v  a 2 s .c om*/
 */
protected void addHelpTextView(View v) {
    if (v == null) {
        Timber.e("cannot add a null view as helpTextView");
        return;
    }

    // default for helptext
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.BELOW, questionMediaLayout.getId());
    params.setMargins(10, 0, 10, 0);
    addView(v, params);
}

From source file:info.tellmetime.DaydreamService.java

private void inflateMinutesIndicators() {
    FrameLayout minutesLayout = (FrameLayout) findViewById(R.id.minutes_indicators);
    minutesLayout.removeAllViews();/*from   ww  w. java2s. c  o m*/
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final boolean isLandscape = getResources()
            .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
    inflater.inflate(isLandscape ? R.layout.minutes_land : R.layout.minutes_portrait, minutesLayout);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT,
            isLandscape ? FrameLayout.LayoutParams.MATCH_PARENT : FrameLayout.LayoutParams.WRAP_CONTENT);
    if (!isLandscape) {
        layoutParams.addRule(RelativeLayout.BELOW, R.id.clock);
        layoutParams.topMargin = (int) -TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mMinutesSize / 3,
                getResources().getDisplayMetrics());
    }
    minutesLayout.setLayoutParams(layoutParams);

    Typeface mTypefaceBold = Typeface.createFromAsset(getAssets(), "Roboto-BoldCondensed.ttf");
    ViewGroup minutesDots = (ViewGroup) findViewById(R.id.minutes_dots);
    for (int i = 0; i < minutesDots.getChildCount(); i++) {
        TextView m = (TextView) minutesDots.getChildAt(i);

        m.setTypeface(mTypefaceBold);
        m.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mMinutesSize);
        m.setTextColor(mBacklightColor);
        m.setShadowLayer(mShorterEdge / 200 * mDensity, 0, 0, mBacklightColor);
    }
}