Example usage for android.widget TextView setId

List of usage examples for android.widget TextView setId

Introduction

In this page you can find the example usage for android.widget TextView setId.

Prototype

public void setId(@IdRes int id) 

Source Link

Document

Sets the identifier for this view.

Usage

From source file:de.vanita5.twittnuker.fragment.support.BaseSupportListFragment.java

/**
 * Provide default implementation to return a simple list view. Subclasses
 * can override to replace with their own layout. If doing so, the returned
 * view hierarchy <em>must</em> have a ListView whose id is
 * {@link android.R.id#list android.R.id.list} and can optionally have a
 * sibling view id {@link android.R.id#empty android.R.id.empty} that is to
 * be shown when the list is empty.//from   ww  w  .  j a v  a  2s.c  o m
 *
 * <p>
 * If you are overriding this method with your own custom content, consider
 * including the standard layout {@link android.R.layout#list_content} in
 * your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment. In particular, this is currently the only way
 * to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final Context context = getActivity();

    final FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    final LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    final FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    final TextView tv = new TextView(getActivity());
    tv.setTextAppearance(context, ThemeUtils.getTextAppearanceLarge(context));
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    final ListView lv = new ListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lv.setOnScrollListener(this);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:com.sayagodshala.livesplash.fragments.category.CategorySlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*from  w  w  w. ja v a  2  s  .  co m*/
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTextColor(0xFFFFFFFF);
    textView.setId(R.id.TAG_ID);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(true);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}

From source file:id.nci.stm_9.ExpandableListFragment.java

/**
 * Provide default implementation to return a simple list view. Subclasses can override to
 * replace with their own layout. If doing so, the returned view hierarchy <em>must</em> have a
 * ListView whose id is {@link android.R.id#list android.R.id.list} and can optionally have a
 * sibling view id {@link android.R.id#empty android.R.id.empty} that is to be shown when the
 * list is empty.//from ww w . ja v  a2s .  c  o m
 * 
 * <p>
 * If you are overriding this method with your own custom content, consider including the
 * standard layout {@link android.R.layout#list_content} in your layout file, so that you
 * continue to retain all of the standard behavior of ListFragment. In particular, this is
 * currently the only way to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();

    FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    ExpandableListView lv = new ExpandableListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:org.getlantern.firetweet.fragment.support.BaseSupportListFragment.java

/**
 * Provide default implementation to return a simple list view. Subclasses
 * can override to replace with their own layout. If doing so, the returned
 * view hierarchy <em>must</em> have a ListView whose id is
 * {@link android.R.id#list android.R.id.list} and can optionally have a
 * sibling view id {@link android.R.id#empty android.R.id.empty} that is to
 * be shown when the list is empty.//from w ww  .  ja  va2s  .c o  m
 * <p/>
 * <p/>
 * If you are overriding this method with your own custom content, consider
 * including the standard layout {@link android.R.layout#list_content} in
 * your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment. In particular, this is currently the only way
 * to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final Context context = getActivity();

    final FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    final LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    final ExtendedFrameLayout lframe = new ExtendedFrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);
    lframe.setTouchInterceptor(mInternalOnTouchListener);

    final TextView tv = new TextView(getActivity());
    tv.setTextAppearance(context, ThemeUtils.getTextAppearanceLarge(context));
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    final ListView lv = new ListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lv.setOnScrollListener(this);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:org.dvbviewer.controller.ui.base.BaseListFragment.java

/**
 * Provide default implementation to return a simple list view.  Subclasses
 * can override to replace with their own layout.  If doing so, the
 * returned view hierarchy <em>must</em> have a ListView whose id
 * is {@link android.R.id#list android.R.id.list} and can optionally
 * have a sibling view id {@link android.R.id#empty android.R.id.empty}
 * that is to be shown when the list is empty.
 * //from   ww  w  .  j  a v  a2s.c  o  m
 * <p>If you are overriding this method with your own custom content,
 * consider including the standard layout {@link android.R.layout#list_content}
 * in your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment.  In particular, this is currently the only
 * way to have the built-in indeterminant progress state be shown.
 *
 * @param inflater the inflater
 * @param container the container
 * @param savedInstanceState the saved instance state
 * @return the view
 * @author RayBa
 * @date 07.04.2013
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    if (layoutRessource > 0) {
        View v = getLayoutInflater(savedInstanceState).inflate(layoutRessource, null);
        return v;
    } else {
        FrameLayout root = new FrameLayout(context);

        // ------------------------------------------------------------------

        LinearLayout pframe = new LinearLayout(context);
        pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
        pframe.setOrientation(LinearLayout.VERTICAL);
        pframe.setVisibility(View.GONE);
        pframe.setGravity(Gravity.CENTER);

        ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyle);
        pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));

        root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        // ------------------------------------------------------------------

        FrameLayout lframe = new FrameLayout(context);
        lframe.setId(INTERNAL_LIST_CONTAINER_ID);

        TextView tv = new TextView(getActivity());
        tv.setId(INTERNAL_EMPTY_ID);
        tv.setGravity(Gravity.CENTER);
        tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
        lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        ListView lv = new ListView(getActivity());
        lv.setId(android.R.id.list);
        lv.setDrawSelectorOnTop(false);
        lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        // ------------------------------------------------------------------

        root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        return root;
    }
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.v(TAG, "Account Activity onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.account_activity);

    Bundle b = getIntent().getExtras();//from  w w w .j  av  a 2 s. com
    portfolio = b.getParcelable("portfolio");

    errorView = (TextView) findViewById(R.id.errorMessage);
    totalValueView = (TextView) findViewById(R.id.totalValue);
    totalGainView = (TextView) findViewById(R.id.totalGain);
    totalPlusMinusValueView = (TextView) findViewById(R.id.totalPlusMinusValue);
    lastUpateView = (TextView) findViewById(R.id.lastUpdate);
    liquidityView = (TextView) findViewById(R.id.liquidity);
    yieldYearView = (TextView) findViewById(R.id.yieldYear);
    shareValueView = (TextView) findViewById(R.id.shareValue);
    gainView = (TextView) findViewById(R.id.gain2);
    perfView = (TextView) findViewById(R.id.perf);
    yieldView = (TextView) findViewById(R.id.yieldPerf);
    taxesView = (TextView) findViewById(R.id.taxes);

    RelativeLayout accLayout = (RelativeLayout) findViewById(R.id.accountsLayout);
    TextView recent = new TextView(getApplicationContext());
    textViews = new ArrayList<TextView>();
    int id = 1;
    int nameID = 100;
    int viewId1 = 500;
    int currencyId = 1000;
    for (int i = 0; i < portfolio.getAccounts().size(); i++) {
        Account account = portfolio.getAccounts().get(i);
        TextView currentAccountNameTextView = new TextView(getApplicationContext());
        currentAccountNameTextView.setText(account.getName());
        currentAccountNameTextView.setTextColor(Color.GRAY);
        currentAccountNameTextView.setId(nameID);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) LayoutParams.WRAP_CONTENT,
                (int) LayoutParams.WRAP_CONTENT);
        if (i != 0) {
            params.addRule(RelativeLayout.BELOW, recent.getId());
        }
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        currentAccountNameTextView.setLayoutParams(params);
        accLayout.addView(currentAccountNameTextView, params);
        textViews.add(currentAccountNameTextView);

        View viewPoint1 = new View(getApplicationContext());
        viewPoint1.setId(viewId1);
        viewPoint1.setBackgroundColor(getResources().getColor(R.color.grey_light));
        params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT, 2);
        params.addRule(RelativeLayout.RIGHT_OF, nameID);
        params.addRule(RelativeLayout.LEFT_OF, currencyId);
        params.setMargins(0, Util.convertDpToPxl(15, getApplicationContext()), 0, 0);
        if (i != 0) {
            params.addRule(RelativeLayout.BELOW, recent.getId());
        }
        viewPoint1.setLayoutParams(params);
        accLayout.addView(viewPoint1, params);

        TextView currentCurrencyTextView = new TextView(getApplicationContext());
        currentCurrencyTextView.setText(account.getCurrency());
        currentCurrencyTextView.setTextColor(Color.GRAY);
        currentCurrencyTextView.setId(currencyId);
        params = new RelativeLayout.LayoutParams((int) LayoutParams.WRAP_CONTENT,
                (int) LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
        if (i != 0) {
            params.addRule(RelativeLayout.BELOW, recent.getId());
        }
        currentCurrencyTextView.setLayoutParams(params);
        accLayout.addView(currentCurrencyTextView, params);
        textViews.add(currentCurrencyTextView);

        View viewPoint2 = new View(getApplicationContext());
        viewPoint2.setBackgroundColor(getResources().getColor(R.color.grey_light));
        params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT, 2);
        params.addRule(RelativeLayout.RIGHT_OF, currencyId);
        params.addRule(RelativeLayout.LEFT_OF, id);
        params.setMargins(0, Util.convertDpToPxl(15, getApplicationContext()), 0, 0);
        if (i != 0) {
            params.addRule(RelativeLayout.BELOW, recent.getId());
        }
        viewPoint2.setLayoutParams(params);
        accLayout.addView(viewPoint2, params);

        TextView currentTextView = new TextView(getApplicationContext());
        currentTextView.setText(account.getLiquidity());
        currentTextView.setTextColor(Color.GRAY);
        currentTextView.setId(id);
        params = new RelativeLayout.LayoutParams((int) LayoutParams.WRAP_CONTENT,
                (int) LayoutParams.WRAP_CONTENT);
        if (i != 0) {
            params.addRule(RelativeLayout.BELOW, recent.getId());
        }
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        currentTextView.setLayoutParams(params);
        recent = currentTextView;
        accLayout.addView(currentTextView, params);
        textViews.add(currentTextView);

        id++;
        nameID++;
        viewId1++;
        currencyId++;
    }
    buildUi(false);
    // Set context
    EasyTracker.getInstance().setContext(getApplicationContext());
    // Instantiate the Tracker
    tracker = EasyTracker.getTracker();
}

From source file:com.app.plugins.childBrowser.ChildBrowser.java

/**
 * Display a new browser with the specified URL.
 *
 * @param url           The url to load.
 * @param jsonObject /*from w w w  .ja  v a 2s.  c  o m*/
 */
public String showWebPage(final String url, JSONObject options) {
    // Determine if we should hide the location bar.
    if (options != null) {
        showLocationBar = options.optBoolean("showLocationBar", false);
    }

    final WebView parent = this.webView;

    // Create dialog in new thread 
    Runnable runnable = new Runnable() {
        public void run() {
            dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);

            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCancelable(true);
            dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                public void onDismiss(DialogInterface dialog) {
                    try {
                        JSONObject obj = new JSONObject();
                        obj.put("type", CLOSE_EVENT);

                        sendUpdate(obj, false);
                    } catch (JSONException e) {
                        Log.d(LOG_TAG, "Should never happen");
                    }
                }
            });

            //LinearLayout.LayoutParams backParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
            //LinearLayout.LayoutParams forwardParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
            //LinearLayout.LayoutParams editParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT, 1.0f);
            LinearLayout.LayoutParams closeParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                    LayoutParams.WRAP_CONTENT);
            LinearLayout.LayoutParams wvParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
                    LayoutParams.FILL_PARENT);

            LinearLayout main = new LinearLayout(cordova.getActivity());
            main.setOrientation(LinearLayout.VERTICAL);

            LinearLayout toolbar = new LinearLayout(cordova.getActivity());
            toolbar.setOrientation(LinearLayout.HORIZONTAL);

            /*
            ImageButton back = new ImageButton((Context) ctx);
            back.getBackground().setAlpha(0);
            back.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                goBack();
            }
            });
            back.setId(1);
            try {
            back.setImageBitmap(loadDrawable("plugins/childbrowser/icon_arrow_left.png"));
            } catch (IOException e) {
            Log.e(LOG_TAG, e.getMessage(), e);
            }
            back.setLayoutParams(backParams);
                    
            ImageButton forward = new ImageButton((Context) ctx);
            forward.getBackground().setAlpha(0);
            forward.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                goForward();
            }
            });
            forward.setId(2);
            try {
            forward.setImageBitmap(loadDrawable("plugins/childbrowser/icon_arrow_right.png"));
            } catch (IOException e) {
            Log.e(LOG_TAG, e.getMessage(), e);
            }               
            forward.setLayoutParams(forwardParams);
            */

            /*
            edittext = new EditText((Context) ctx);
            edittext.setOnKeyListener(new View.OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                // If the event is a key-down event on the "enter" button
                if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                  navigate(edittext.getText().toString());
                  return true;
                }
                return false;
            }
            });
            edittext.setId(3);
            edittext.setSingleLine(true);
            edittext.setText(url);
            edittext.setLayoutParams(editParams);
            */
            //edittext = new EditText((Context) ctx);
            //edittext.setVisibility(View.GONE);

            LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                    LayoutParams.FILL_PARENT, 1.0f);
            TextView title = new TextView(cordova.getActivity());
            title.setId(1);
            title.setLayoutParams(titleParams);
            title.setGravity(Gravity.CENTER_VERTICAL);
            title.setTypeface(null, Typeface.BOLD);

            ImageButton close = new ImageButton(cordova.getActivity());
            close.getBackground().setAlpha(0);
            close.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    closeDialog();
                }
            });
            close.setId(4);
            try {
                close.setImageBitmap(loadDrawable("plugins/childbrowser/icon_close.png"));
            } catch (IOException e) {
                Log.e(LOG_TAG, e.getMessage(), e);
            }
            close.setLayoutParams(closeParams);

            childWebView = new WebView(cordova.getActivity());
            childWebView.getSettings().setJavaScriptEnabled(true);
            childWebView.getSettings().setBuiltInZoomControls(true);
            WebViewClient client = new ChildBrowserClient(parent, ctx, title/*, edittext*/);
            childWebView.setWebViewClient(client);
            childWebView.loadUrl(url);
            childWebView.setId(5);
            childWebView.setInitialScale(0);
            childWebView.setLayoutParams(wvParams);
            childWebView.requestFocus();
            childWebView.requestFocusFromTouch();

            //toolbar.addView(back);
            //toolbar.addView(forward);
            //toolbar.addView(edittext);
            toolbar.addView(close);
            toolbar.addView(title);

            if (getShowLocationBar()) {
                main.addView(toolbar);
            }
            main.addView(childWebView);

            WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
            lp.copyFrom(dialog.getWindow().getAttributes());
            lp.width = WindowManager.LayoutParams.FILL_PARENT;
            lp.height = WindowManager.LayoutParams.FILL_PARENT;
            lp.verticalMargin = 0f;
            lp.horizontalMargin = 0f;

            dialog.setContentView(main);
            dialog.show();
            dialog.getWindow().setAttributes(lp);
        }

        private Bitmap loadDrawable(String filename) throws java.io.IOException {
            InputStream input = cordova.getActivity().getAssets().open(filename);
            return BitmapFactory.decodeStream(input);
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
    return "";
}

From source file:com.google.samples.apps.iosched.myschedule.MyScheduleActivity.java

private void setTabLayoutContentDescriptions() {
    LayoutInflater inflater = getLayoutInflater();
    int gap = mDayZeroAdapter == null ? 0 : 1;
    for (int i = 0, count = mTabLayout.getTabCount(); i < count; i++) {
        TabLayout.Tab tab = mTabLayout.getTabAt(i);
        TextView view = (TextView) inflater.inflate(R.layout.tab_my_schedule, mTabLayout, false);
        view.setId(baseTabViewId + i);
        view.setText(tab.getText());/*from   www .ja  v  a 2s. c  om*/
        if (i == 0) {
            view.setContentDescription(
                    getString(R.string.talkback_selected, getString(R.string.a11y_button, tab.getText())));
        } else {
            view.setContentDescription(getString(R.string.a11y_button, tab.getText()));
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.announceForAccessibility(getString(R.string.my_schedule_tab_desc_a11y, getDayName(i - gap)));
        }
        tab.setCustomView(view);
    }
}

From source file:fiskinfoo.no.sintef.fiskinfoo.CardViewFragment.java

private TextView generateTextViewWithText(String text, TextView parent) {
    TextView textView = new TextView(getActivity());
    RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    p.addRule(RelativeLayout.BELOW, parent.getId());
    textView.setLayoutParams(p);/*  w ww  .j  a v a 2 s.co m*/
    textView.setId(generateRandomId());
    textView.setText(text);
    textView.setPadding(8, 8, 8, 8);
    textView.setTextColor(Color.parseColor("#666666"));
    textView.setTextSize(14);
    return textView;
}

From source file:com.joravasal.comicagg.ComicDetailFragment.java

@SuppressLint({ "NewApi" })
@Override//  w  ww  .  j av a 2 s.  com
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_comic_detail, container, false);
    if (comicItem == null && savedInstanceState.containsKey(ARG_ITEM_ID)) {
        comicItem = new ComicItem(savedInstanceState.getString(ARG_ITEM_ID),
                savedInstanceState.getString("comicname"), savedInstanceState.getString("comicurl"),
                savedInstanceState.getString("unreadcount"));
    }
    int unread = Integer.parseInt(comicItem.unreadCount);
    if (unread == 0) {
        rootView.findViewById(R.id.vote_bar).setVisibility(View.GONE);
    }
    LinearLayout stripList = (LinearLayout) rootView.findViewById(R.id.strips_list);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    if (comicItem.id.equals(ComicStripsContent.id) && ComicStripsContent.ITEMS.size() > unread) {
        unread = ComicStripsContent.ITEMS.size();
    }
    for (int i = 1; i < unread; i++) {
        ImageView iv = new ImageView(getActivity());
        iv.setId(Integer.MAX_VALUE - i);
        iv.setPadding(16, 16, 16, 0);
        iv.setContentDescription(getString(R.string.strip_description));
        iv.setAdjustViewBounds(true);

        iv.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO check if there is need of opening? or always open?
                openFullscreenStrip(v);
            }
        });

        TextView tv = new TextView(getActivity());
        tv.setId(i);
        tv.setPadding(16, 4, 16, 4);
        tv.setGravity(Gravity.CENTER);

        stripList.addView(iv, layoutParams);
        stripList.addView(tv, layoutParams);
    }

    if (!comicItem.id.equals(ComicStripsContent.id)) {
        new GetComicsStrips(comicItem.id, unread, rootView).execute();
    } else {
        new GetComicsStrips(comicItem.id, unread, rootView).onPostExecute(null);
    }
    if (savedInstanceState != null && savedInstanceState.containsKey(VERTICAL_SCROLLING_POSITION)
            && VERSION.SDK_INT >= 14) {
        rootView.findViewById(R.id.comic_scrollView).scrollTo(0,
                savedInstanceState.getInt(VERTICAL_SCROLLING_POSITION));
    }
    return rootView;
}