Example usage for android.widget LinearLayout HORIZONTAL

List of usage examples for android.widget LinearLayout HORIZONTAL

Introduction

In this page you can find the example usage for android.widget LinearLayout HORIZONTAL.

Prototype

int HORIZONTAL

To view the source code for android.widget LinearLayout HORIZONTAL.

Click Source Link

Usage

From source file:com.example.fan.horizontalscrollview.PagerSlidingTabStrip.java

private void addWarningTab(final int position, String title, int resId) {
    LinearLayout tabLayout = new LinearLayout(getContext());
    tabLayout.setOrientation(LinearLayout.HORIZONTAL);
    tabLayout.setGravity(Gravity.CENTER);

    ImageView tabImg = new ImageView(getContext());
    int width = DimenUtils.dp2px(getContext(), 18);
    LinearLayout.LayoutParams tabImgParams = new LinearLayout.LayoutParams(width, width);
    tabImgParams.setMargins(0, 0, DimenUtils.dp2px(getContext(), 10), 0);
    tabImgParams.gravity = Gravity.CENTER;
    tabImg.setLayoutParams(tabImgParams);
    if (resId != -1) {
        tabImg.setBackgroundResource(resId);
        tabImg.setVisibility(View.VISIBLE);
    } else {//from   w w  w .j a  v  a2  s.  c  o m
        tabImg.setVisibility(View.GONE);
    }
    tabLayout.addView(tabImg, 0);

    TextView tab = new TextView(getContext());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(getResources().getColorStateList(
            mTextChangeable ? R.color.pst_tab_changeable_text_selector : R.color.pst_tab_text_selector));
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18.0f);
    tabLayout.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != mOnPageClickedLisener) {
                mOnPageClickedLisener.onPageClicked(position);
            }
            pager.setCurrentItem(position);
        }
    });
    tabLayout.addView(tab, 1);

    tabsContainer.addView(tabLayout);
}

From source file:com.todoroo.astrid.taskrabbit.TaskRabbitActivity.java

private void displayViewsForMode(int mode) {

    taskControls.removeAllViews();//  w ww .  j ava2  s  .co m
    descriptionControls.removeAllViews();

    if (row == null) {
        row = new LinearLayout(this);
        row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        row.setOrientation(LinearLayout.HORIZONTAL);
    } else {
        row.removeAllViews();
    }

    if (menuTitle != null) {
        menuTitle.setText(getResources().getStringArray(R.array.tr_preset_types)[mode]);
    }
    int[] presetValues = getPresetValues(mode);
    TypedArray keys = getResources().obtainTypedArray(R.array.tr_default_set_key);
    JSONObject parameters = defaultValuesToJSON(keys, presetValues);
    for (int i = 0; i < controls.size(); i++) {
        if (presetValues[i] == -1)
            continue;
        TaskRabbitSetListener set = controls.get(i);
        int arrayID = keys.getResourceId(i, 0);
        if (arrayID == R.string.tr_set_key_cost_in_cents || arrayID == R.string.tr_set_key_named_price) {
            if (row.getParent() == null)
                taskControls.addView(row);
            else {
                //                    View separator = getLayoutInflater().inflate(R.layout.tea_separator, row);
                //                    separator.setLayoutParams(new LayoutParams(1, LayoutParams.FILL_PARENT));

            }
            LinearLayout displayRow = (LinearLayout) ((TaskEditControlSet) set).getDisplayView();
            LinearLayout.LayoutParams layoutParams = null;
            if (arrayID == R.string.tr_set_key_named_price) {
                layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                        LayoutParams.FILL_PARENT, 1);
                displayRow.findViewById(R.id.display_row_body).setPadding(5, 0, 10, 0);
                displayRow.setMinimumWidth(130);
            } else {
                layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                        LayoutParams.FILL_PARENT, 1);
                displayRow.findViewById(R.id.display_row_body).setPadding(10, 0, 5, 0);
            }
            row.addView(displayRow, layoutParams);
        } else if (arrayID == R.string.tr_set_key_description) {
            descriptionControls.addView(((TaskEditControlSet) set).getDisplayView());
        } else {
            taskControls.addView(((TaskEditControlSet) set).getDisplayView());
        }
        ((TaskRabbitSetListener) set).readFromModel(parameters, getString(arrayID), currentSelectedItem);
    }
}

From source file:com.richtodd.android.quiltdesign.app.QuiltEditActivity.java

private void populateLayoutBlocks() {
    List<BlockContainerEntry> entries;
    try {/*from  ww w  . j av a2s  .c om*/
        Repository repository = Repository.getDefaultRepository(this);
        BlockContainer blocks = repository.getBlocks();
        entries = blocks.getEntries(true);
    } catch (RepositoryException ex) {
        return;
    }

    LinearLayout layoutRow = null;

    for (BlockContainerEntry entry : entries) {
        View view = QuiltEditActivity.this.getLayoutInflater().inflate(R.layout.listentry_block_selector, null);

        ImageView image_thumbnail = (ImageView) view.findViewById(R.id.image_thumbnail);
        image_thumbnail.setImageBitmap(entry.getThumbnail());

        view.setTag(entry.getBlockName());
        view.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                String blockName = (String) v.getTag();
                try {
                    getQuiltEditFragment().setBlock(blockName);
                } catch (Exception e) {
                    Handle.asRuntimeError(e);
                }
            }
        });

        if (m_layout_blocks.getOrientation() == LinearLayout.HORIZONTAL) {
            m_layout_blocks.addView(view);
        } else {
            if (layoutRow != null && layoutRow.getChildCount() == m_layout_blocks.getNumColumns()) {
                layoutRow = null;
            }
            if (layoutRow == null) {
                layoutRow = new LinearLayout(this);
                layoutRow.setOrientation(LinearLayout.HORIZONTAL);
                m_layout_blocks.addView(layoutRow);
            }
            layoutRow.addView(view);
        }
    }
}

From source file:cm.aptoide.pt.MainActivity.java

private void loadRecommended() {

    if (Login.isLoggedIn(mContext)) {
        ((TextView) featuredView.findViewById(R.id.recommended_text)).setVisibility(View.GONE);
    } else {/*  w  w w .  j ava2s .co m*/
        ((TextView) featuredView.findViewById(R.id.recommended_text)).setVisibility(View.VISIBLE);
    }

    new Thread(new Runnable() {

        private ArrayList<HashMap<String, String>> valuesRecommended;

        public void run() {
            loadUIRecommendedApps();
            File f = null;
            try {
                SAXParserFactory spf = SAXParserFactory.newInstance();
                SAXParser sp = spf.newSAXParser();
                NetworkUtils utils = new NetworkUtils();
                BufferedInputStream bis = new BufferedInputStream(
                        utils.getInputStream("http://webservices.aptoide.com/webservices/listUserBasedApks/"
                                + Login.getToken(mContext) + "/10/xml", null, null, mContext),
                        8 * 1024);
                f = File.createTempFile("abc", "abc");
                OutputStream out = new FileOutputStream(f);
                byte buf[] = new byte[1024];
                int len;
                while ((len = bis.read(buf)) > 0)
                    out.write(buf, 0, len);
                out.close();
                bis.close();
                String hash = Md5Handler.md5Calc(f);
                ViewApk parent_apk = new ViewApk();
                parent_apk.setApkid("recommended");
                if (!hash.equals(db.getItemBasedApksHash(parent_apk.getApkid()))) {
                    // Database.database.beginTransaction();
                    db.deleteItemBasedApks(parent_apk);
                    sp.parse(f, new HandlerItemBased(parent_apk));
                    db.insertItemBasedApkHash(hash, parent_apk.getApkid());
                    // Database.database.setTransactionSuccessful();
                    // Database.database.endTransaction();
                    loadUIRecommendedApps();
                }

            } catch (Exception e) {
                e.printStackTrace();
            }

            if (f != null)
                f.delete();

        }

        private void loadUIRecommendedApps() {

            valuesRecommended = db.getItemBasedApksRecommended("recommended");

            runOnUiThread(new Runnable() {

                public void run() {

                    LinearLayout ll = (LinearLayout) featuredView.findViewById(R.id.recommended_container);
                    ll.removeAllViews();
                    LinearLayout llAlso = new LinearLayout(MainActivity.this);
                    llAlso.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                            LinearLayout.LayoutParams.WRAP_CONTENT));
                    llAlso.setOrientation(LinearLayout.HORIZONTAL);
                    if (valuesRecommended.isEmpty()) {
                        if (Login.isLoggedIn(mContext)) {
                            TextView tv = new TextView(mContext);
                            tv.setText(R.string.no_recommended_apps);
                            tv.setTextAppearance(mContext, android.R.attr.textAppearanceMedium);
                            tv.setPadding(10, 10, 10, 10);
                            ll.addView(tv);
                        }
                    } else {

                        for (int i = 0; i != valuesRecommended.size(); i++) {
                            LinearLayout txtSamItem = (LinearLayout) getLayoutInflater()
                                    .inflate(R.layout.row_grid_item, null);
                            ((TextView) txtSamItem.findViewById(R.id.name))
                                    .setText(valuesRecommended.get(i).get("name"));
                            ImageLoader.getInstance().displayImage(valuesRecommended.get(i).get("icon"),
                                    (ImageView) txtSamItem.findViewById(R.id.icon));
                            float stars = 0f;
                            try {
                                stars = Float.parseFloat(valuesRecommended.get(i).get("rating"));
                            } catch (Exception e) {
                                stars = 0f;
                            }
                            ((RatingBar) txtSamItem.findViewById(R.id.rating)).setIsIndicator(true);
                            ((RatingBar) txtSamItem.findViewById(R.id.rating)).setRating(stars);
                            txtSamItem.setPadding(10, 0, 0, 0);
                            // ((TextView)
                            // txtSamItem.findViewById(R.id.version))
                            // .setText(getString(R.string.version) +" "+
                            // valuesRecommended.get(i).get("vername"));
                            ((TextView) txtSamItem.findViewById(R.id.downloads))
                                    .setText("(" + valuesRecommended.get(i).get("downloads") + " "
                                            + getString(R.string.downloads) + ")");
                            txtSamItem.setTag(valuesRecommended.get(i).get("_id"));
                            txtSamItem.setLayoutParams(new LinearLayout.LayoutParams(
                                    LinearLayout.LayoutParams.MATCH_PARENT, 100, 1));
                            // txtSamItem.setOnClickListener(featuredListener);
                            txtSamItem.setOnClickListener(new OnClickListener() {

                                @Override
                                public void onClick(View arg0) {
                                    Intent i = new Intent(MainActivity.this, ApkInfo.class);
                                    long id = Long.parseLong((String) arg0.getTag());
                                    i.putExtra("_id", id);
                                    i.putExtra("top", true);
                                    i.putExtra("category", Category.ITEMBASED.ordinal());
                                    startActivity(i);
                                }
                            });

                            txtSamItem.measure(0, 0);

                            if (i % 2 == 0) {
                                ll.addView(llAlso);

                                llAlso = new LinearLayout(MainActivity.this);
                                llAlso.setLayoutParams(new LinearLayout.LayoutParams(
                                        LinearLayout.LayoutParams.MATCH_PARENT, 100));
                                llAlso.setOrientation(LinearLayout.HORIZONTAL);
                                llAlso.addView(txtSamItem);
                            } else {
                                llAlso.addView(txtSamItem);
                            }
                        }

                        ll.addView(llAlso);
                    }
                }
            });
        }
    }).start();

}

From source file:com.appfirst.activities.details.AFServerDetail.java

/**
 * Draw a ScrollView to display the CPU value for each core.
 * //from   w w w.j ava2 s . co m
 * @return a ScrollView containing a list of BarView.
 */
private View createCPUListDialog() {
    ScrollView container = createOuterContainer();
    LinearLayout innerContainer = createInnerContainer();

    List<BasicNameValuePair> items = data.getCpu_cores();
    for (int i = 0; i < items.size(); i++) {
        BasicNameValuePair item = items.get(i);
        Double value = Double.parseDouble(item.getValue());
        LinearLayout row = createTableRow(LinearLayout.HORIZONTAL);
        AFBarView barView = createBarView(value);
        row.addView(barView);
        innerContainer.addView(row);
    }
    container.addView(innerContainer);
    innerContainer.invalidate();
    container.invalidate();
    return container;
}

From source file:com.wit.and.dialog.LoginDialog.java

/**
 * /*from w  ww  .  j av  a2s  . co m*/
 */
@Override
protected View onCreateBodyView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = inflater.getContext();

    RelativeLayout layout = new RelativeLayout(context);
    // Apply neutral layout params.
    layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    // Do not allow to apply style to body view.
    // layout.setId(R.id.Dialog_Layout_Body);

    // Create layout for loading view.
    LinearLayout loadingLayout = new LinearLayout(context);
    loadingLayout.setOrientation(LinearLayout.HORIZONTAL);
    loadingLayout.setGravity(Gravity.CENTER_VERTICAL);
    // Allow styling of loading layout as body layout.
    loadingLayout.setId(R.id.And_Dialog_Layout_Body);

    // Create text view for message.
    TextView msgTextView = new TextView(context);
    msgTextView.setId(R.id.And_Dialog_TextView_Message);

    // Create circle progress bar.
    ProgressBar circleProgressBar = new ProgressBar(context);
    circleProgressBar.setId(R.id.And_Dialog_ProgressBar);

    // Build loading view.
    loadingLayout.addView(circleProgressBar, new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    loadingLayout.addView(msgTextView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    loadingLayout.setVisibility(View.GONE);

    // Insert loading layout into main body layout.
    RelativeLayout.LayoutParams loadingLayoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    loadingLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(loadingLayout, loadingLayoutParams);

    // Create layout for edit texts.
    LinearLayout editLayout = new LinearLayout(context);
    editLayout.setOrientation(LinearLayout.VERTICAL);
    editLayout.setId(R.id.And_Dialog_Layout_LoginDialog_EditView);

    // Create edit texts for username and password.
    EditText userEdit = new EditText(context);
    userEdit.setId(R.id.And_Dialog_EditText_Username);
    userEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    EditText passEdit = new EditText(context);
    passEdit.setId(R.id.And_Dialog_EditText_Password);
    passEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    // Create edit texts divider.
    DialogDivider divider = new DialogDivider(context);
    divider.setId(R.id.And_Dialog_Divider_LoginDialog_EditTexts);

    // Build edit layout.
    editLayout.addView(userEdit, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    editLayout.addView(divider, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    editLayout.addView(passEdit, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    // Add custom layout.
    View customView = onCreateCustomView(inflater, editLayout, savedInstanceState);
    if (customView != null) {
        editLayout.addView(this.mCustomView = customView);
    }

    // Insert edit layout into main body layout.
    RelativeLayout.LayoutParams editLayoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    editLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(editLayout, editLayoutParams);

    return layout;
}

From source file:com.mifos.mifosxdroid.online.generatecollectionsheet.GenerateCollectionSheetFragment.java

private void inflateCollectionTable(CollectionSheetResponse collectionSheetResponse) {
    //Clear old views in case they are present.
    if (tableProductive.getChildCount() > 0) {
        tableProductive.removeAllViews();
    }//  ww w .j a va 2 s  .  c  o  m

    //A List to be used to inflate Attendance Spinners
    ArrayList<String> attendanceTypes = new ArrayList<>();
    attendanceTypeOptions.clear();
    attendanceTypeOptions = presenter.filterAttendanceTypes(collectionSheetResponse.getAttendanceTypeOptions(),
            attendanceTypes);

    additionalPaymentTypeMap.clear();
    additionalPaymentTypeMap = presenter.filterPaymentTypes(collectionSheetResponse.getPaymentTypeOptions(),
            paymentTypes);

    //Add the heading Row
    TableRow headingRow = new TableRow(getContext());
    TableRow.LayoutParams headingRowParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    headingRowParams.gravity = Gravity.CENTER;
    headingRowParams.setMargins(0, 0, 0, 10);
    headingRow.setLayoutParams(headingRowParams);

    TextView tvGroupName = new TextView(getContext());
    tvGroupName.setText(collectionSheetResponse.getGroups().get(0).getGroupName());
    tvGroupName.setTypeface(tvGroupName.getTypeface(), Typeface.BOLD);
    tvGroupName.setGravity(Gravity.CENTER);
    headingRow.addView(tvGroupName);

    for (LoanProducts loanProduct : collectionSheetResponse.getLoanProducts()) {
        TextView tvProduct = new TextView(getContext());
        tvProduct.setText(getString(R.string.collection_loan_product, loanProduct.getName()));
        tvProduct.setTypeface(tvProduct.getTypeface(), Typeface.BOLD);
        tvProduct.setGravity(Gravity.CENTER);
        headingRow.addView(tvProduct);
    }

    for (SavingsProduct savingsProduct : collectionSheetResponse.getSavingsProducts()) {
        TextView tvSavingProduct = new TextView(getContext());
        tvSavingProduct.setText(getString(R.string.collection_saving_product, savingsProduct.getName()));
        tvSavingProduct.setTypeface(tvSavingProduct.getTypeface(), Typeface.BOLD);
        tvSavingProduct.setGravity(Gravity.CENTER);
        headingRow.addView(tvSavingProduct);
    }

    TextView tvAttendance = new TextView(getContext());
    tvAttendance.setText(getString(R.string.attendance));
    tvAttendance.setGravity(Gravity.CENTER);
    tvAttendance.setTypeface(tvAttendance.getTypeface(), Typeface.BOLD);
    headingRow.addView(tvAttendance);

    tableProductive.addView(headingRow);

    for (ClientCollectionSheet clientCollectionSheet : collectionSheetResponse.getGroups().get(0)
            .getClients()) {
        //Insert rows
        TableRow row = new TableRow(getContext());
        TableRow.LayoutParams rowParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        rowParams.gravity = Gravity.CENTER;
        rowParams.setMargins(0, 0, 0, 10);
        row.setLayoutParams(rowParams);

        //Column 1: Client Name and Id
        TextView tvClientName = new TextView(getContext());
        tvClientName.setText(
                concatIdWithName(clientCollectionSheet.getClientName(), clientCollectionSheet.getClientId()));
        row.addView(tvClientName);

        //Subsequent columns: The Loan products
        for (LoanProducts loanProduct : collectionSheetResponse.getLoanProducts()) {
            //Since there may be several items in this column, create a container.
            LinearLayout productContainer = new LinearLayout(getContext());
            productContainer.setOrientation(LinearLayout.HORIZONTAL);

            //Iterate through all the loans in of this type and add in the container
            for (LoanCollectionSheet loan : clientCollectionSheet.getLoans()) {
                if (loanProduct.getName().equals(loan.getProductShortName())) {
                    //This loan should be shown in this column. So, add it in the container.
                    EditText editText = new EditText(getContext());
                    editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
                    editText.setText(String.format(Locale.getDefault(), "%f", 0.0));
                    //Set the loan id as the Tag of the EditText
                    // in format 'TYPE:ID' which
                    //will later be used as the identifier for this.
                    editText.setTag(TYPE_LOAN + ":" + loan.getLoanId());
                    productContainer.addView(editText);
                }
            }
            row.addView(productContainer);
        }

        //After Loans, show Savings columns
        for (SavingsProduct product : collectionSheetResponse.getSavingsProducts()) {
            //Since there may be several Savings items in this column, create a container.
            LinearLayout productContainer = new LinearLayout(getContext());
            productContainer.setOrientation(LinearLayout.HORIZONTAL);

            //Iterate through all the Savings in of this type and add in the container
            for (SavingsCollectionSheet saving : clientCollectionSheet.getSavings()) {
                if (saving.getProductId() == product.getId()) {
                    //Add the saving in the container
                    EditText editText = new EditText(getContext());
                    editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
                    editText.setText(String.format(Locale.getDefault(), "%f", 0.0));
                    //Set the Saving id as the Tag of the EditText
                    // in 'TYPE:ID' format which
                    //will later be used as the identifier for this.
                    editText.setTag(TYPE_SAVING + ":" + saving.getSavingsId());
                    productContainer.addView(editText);
                }
            }
            row.addView(productContainer);
        }

        Spinner spAttendance = new Spinner(getContext());
        //Set the clientId as its tag which will be used as identifier later.
        spAttendance.setTag(clientCollectionSheet.getClientId());
        setSpinner(spAttendance, attendanceTypes);
        row.addView(spAttendance);

        tableProductive.addView(row);
    }

    if (btnSubmitProductive.getVisibility() != View.VISIBLE) {
        //Show the button the first time sheet is loaded.
        btnSubmitProductive.setVisibility(View.VISIBLE);
        btnSubmitProductive.setOnClickListener(this);
    }

    //If this block has been executed, that means the CollectionSheet
    //which is already shown is for groups.
    btnSubmitProductive.setTag(TAG_TYPE_COLLECTION);

    if (tableAdditional.getVisibility() != View.VISIBLE) {
        tableAdditional.setVisibility(View.VISIBLE);
    }
    //Show Additional Views
    TableRow rowPayment = new TableRow(getContext());
    TextView tvLabelPayment = new TextView(getContext());
    tvLabelPayment.setText(getString(R.string.payment_type));
    rowPayment.addView(tvLabelPayment);
    Spinner spPayment = new Spinner(getContext());
    setSpinner(spPayment, paymentTypes);
    rowPayment.addView(spPayment);
    tableAdditional.addView(rowPayment);

    TableRow rowAccount = new TableRow(getContext());
    TextView tvLabelAccount = new TextView(getContext());
    tvLabelAccount.setText(getString(R.string.account_number));
    rowAccount.addView(tvLabelAccount);
    EditText etPayment = new EditText(getContext());
    rowAccount.addView(etPayment);
    tableAdditional.addView(rowAccount);

    TableRow rowCheck = new TableRow(getContext());
    TextView tvLabelCheck = new TextView(getContext());
    tvLabelCheck.setText(getString(R.string.cheque_number));
    rowCheck.addView(tvLabelCheck);
    EditText etCheck = new EditText(getContext());
    rowCheck.addView(etCheck);
    tableAdditional.addView(rowCheck);

    TableRow rowRouting = new TableRow(getContext());
    TextView tvLabelRouting = new TextView(getContext());
    tvLabelRouting.setText(getString(R.string.routing_code));
    rowRouting.addView(tvLabelRouting);
    EditText etRouting = new EditText(getContext());
    rowRouting.addView(etRouting);
    tableAdditional.addView(rowRouting);

    TableRow rowReceipt = new TableRow(getContext());
    TextView tvLabelReceipt = new TextView(getContext());
    tvLabelReceipt.setText(getString(R.string.receipt_number));
    rowReceipt.addView(tvLabelReceipt);
    EditText etReceipt = new EditText(getContext());
    rowReceipt.addView(etReceipt);
    tableAdditional.addView(rowReceipt);

    TableRow rowBank = new TableRow(getContext());
    TextView tvLabelBank = new TextView(getContext());
    tvLabelBank.setText(getString(R.string.bank_number));
    rowBank.addView(tvLabelBank);
    EditText etBank = new EditText(getContext());
    rowBank.addView(etBank);
    tableAdditional.addView(rowBank);
}

From source file:android.support.designox.widget.TextInputLayout.java

private void addIndicator(TextView indicator, int index) {
    if (mIndicatorArea == null) {
        mIndicatorArea = new LinearLayout(getContext());
        mIndicatorArea.setOrientation(LinearLayout.HORIZONTAL);
        addView(mIndicatorArea, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);

        // Add a flexible spacer in the middle so that the left/right views stay pinned
        final Space spacer = new Space(getContext());
        final LinearLayout.LayoutParams spacerLp = new LinearLayout.LayoutParams(0, 0, 1f);
        mIndicatorArea.addView(spacer, spacerLp);

        if (mEditText != null) {
            adjustIndicatorPadding();//from  ww  w  .  j av a 2 s  .co m
        }
    }
    mIndicatorArea.setVisibility(View.VISIBLE);
    mIndicatorArea.addView(indicator, index);
    mIndicatorsAdded++;
}

From source file:demo.design.TextInputLayout.java

private void addIndicator(TextView indicator, int index) {
    if (mIndicatorArea == null) {
        mIndicatorArea = new LinearLayout(getContext());
        mIndicatorArea.setOrientation(LinearLayout.HORIZONTAL);
        addView(mIndicatorArea, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

        // Add a flexible spacer in the middle so that the left/right views stay pinned
        final Space spacer = new Space(getContext());
        final LayoutParams spacerLp = new LayoutParams(0, 0, 1f);
        //???view?edittextlayout_marginLeftlayout_marginRight
        //?//  ww  w .j av  a2s .c o m
        mIndicatorArea.addView(spacer, spacerLp);

        if (mEditText != null) {
            adjustIndicatorPadding();
        }
    }
    mIndicatorArea.setVisibility(View.VISIBLE);
    mIndicatorArea.addView(indicator, index);
    mIndicatorsAdded++;
}

From source file:com.telerik.examples.primitives.ExampleViewPagerBase.java

private int getScroll(View v) {
    if (this.orientation == LinearLayout.HORIZONTAL) {
        return v.getScrollX();
    }/*from  w w  w.j  a  v  a  2  s .  c o  m*/

    return v.getScrollY();
}