List of usage examples for android.widget TextView TextView
public TextView(Context context)
From source file:com.ageelg.android.testviewpagerwslider.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); //fl.setLayoutParams(params); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); //params.setMargins(margin, margin, margin, margin); //v.setLayoutParams(params); //v.setLayoutParams(params); v.setGravity(Gravity.CENTER);/*from w w w .j a va2 s. co m*/ v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.temboo.example.YouTubeResultView.java
public YouTubeResultView(Context context, String title, String url, String thumbnailURL) { super(context); super.setOrientation(HORIZONTAL); // Create the link text view, and make the link clickable linkView = new TextView(getContext()); linkView.setMovementMethod(LinkMovementMethod.getInstance()); // Set the link text linkView.append(Html.fromHtml("<a href='" + url + "'>" + title + "</a>")); // Populate the image view try {//www . j av a2 s .c o m imageView = new ImageView(getContext()); imageView.setPadding(4, 4, 4, 0); fetchDrawableOnThread(thumbnailURL, imageView); super.addView(imageView); } catch (Exception e) { Toast.makeText(getContext(), "An error occurred retrieving the video thumbnail", Toast.LENGTH_LONG) .show(); } super.addView(linkView); }
From source file:com.astuetz.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);// ww w . java 2 s .co m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.arta.lib.demo.widget.pagerslidingtabstrip.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);//from w w w. jav a 2s. co m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.pagerslidingtabstrip_background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.commnsense.proximity.fragments.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from ww w . j av a2s . c o m*/ fl.setBackgroundColor(0xffa9a9a9); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.carinsurance.pagerslidingtabstrip.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);//from ww w . ja va 2 s . co m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:at.tomtasche.reader.ui.widget.RecentDocumentDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new Builder(getActivity()); builder.setTitle(R.string.dialog_recent_title); builder.setCancelable(true);//from w w w. j a v a 2 s .c o m TextView emptyView = new TextView(getActivity()); emptyView.setText(R.string.dialog_loading_title); listView = new ListView(getActivity()); listView.setEmptyView(emptyView); listView.setOnItemClickListener(this); listView.setOnItemLongClickListener(this); adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, new String[0]); listView.setAdapter(adapter); builder.setView(listView); setCancelable(true); items = new HashMap<String, String>(); loadRecentDocuments(); listView.setEmptyView(emptyView); return builder.create(); }
From source file:am.project.x.business.widgets.gradienttabstrip.GradientTabStripActivity.java
private ArrayList<View> getPagers() { ArrayList<View> views = new ArrayList<>(); for (int i = 0; i < 4; i++) { TextView text = new TextView(this); text.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 180); text.setText(String.format(Locale.getDefault(), "%d", i + 1)); text.setGravity(Gravity.CENTER); text.setTextColor(0xff000000);//w w w . ja v a2s . c o m views.add(text); } return views; }
From source file:com.collcloud.frame.viewpager.main.Fragment1.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from ww w . j ava 2 s . c o m*/ final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.tab_pagertab_background_card); v.setText("fragment1 CARD is " + (position + 1)); fl.addView(v); return fl; }
From source file:com.collcloud.frame.viewpager.main.Fragment2.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);//from w w w . j a va 2 s.co m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.tab_pagertab_background_card); v.setText("fragment2 CARD is " + (position + 1)); fl.addView(v); return fl; }