List of usage examples for android.widget TextView setAlpha
public void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)
From source file:org.shaastra.helper.SuperAwesomeCardFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/*from ww w. j av a 2 s .c o m*/ 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); //v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); if (position == 0) { View v1 = inflater.inflate(R.layout.event_info, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView t1 = (TextView) v1.findViewById(R.id.infotext); t1.setText(eintroduction); return v1; } else if (position == 1) { String Venue = new String(); Venue = evenue; final String SAC = elatlong; //String start=String.valueOf(l.getLatitude())+String.valueOf(l.getLongitude()); /* View v1=inflater.inflate(R.layout.map, container,false); v1.setLayoutParams(params); WebView wv=(WebView)v1.findViewById(R.id.wv1); wv.setWebChromeClient(new WebChromeClient()); //wv.loadUrl("https://maps.google.com/maps?saddr=13,80&daddr=13,80.02"); //wv.loadUrl("http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false"); wv.loadUrl("http://maps.google.com/maps?f=d&daddr=51.448,-0.972"); wv.getSettings().getBuiltInZoomControls(); */ View v1 = inflater.inflate(R.layout.map, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView location = (TextView) v1.findViewById(R.id.locationText); Button mapButton = (Button) v1.findViewById(R.id.mapButton); if (evenue.equalsIgnoreCase("NONE")) { mapButton.setAlpha(0); } else { mapButton.setAlpha(1); } location.setText(Venue); mapButton.setOnTouchListener(new View.OnTouchListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @SuppressLint("NewApi") @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if (event.getAction() == MotionEvent.ACTION_DOWN) { v.setAlpha((float) 0.4); v.animate().setInterpolator(new DecelerateInterpolator()).scaleX(0.9f).scaleY(0.9f); } if (event.getAction() == MotionEvent.ACTION_UP) { v.setAlpha((float) 0.75); v.animate().setInterpolator(new OvershootInterpolator()).scaleX(1f).scaleY(1f); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&daddr=" + SAC)); intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity")); startActivity(intent); } return false; } }); return v1; } else if (position == 2) { View v1 = inflater.inflate(R.layout.event_info, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView t1 = (TextView) v1.findViewById(R.id.infotext); t1.setText(eformat); return v1; } else if (position == 3) { View v1 = inflater.inflate(R.layout.prize, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView t1 = (TextView) v1.findViewById(R.id.prizeText); t1.setText(eprize); return v1; } else if (position == 4) { v.setBackgroundColor(Color.GREEN); } else if (position == 5) { v.setBackgroundColor(Color.MAGENTA); } else if (position == 6) { v.setBackgroundColor(Color.MAGENTA); } fl.addView(v); return fl; }
From source file:com.android.soma.Launcher.java
private void setCustomContentHintVisibility(Cling cling, String ccHintStr, boolean visible, boolean animate) { final TextView ccHint = (TextView) cling.findViewById(R.id.custom_content_hint); if (ccHint != null) { if (visible && !ccHintStr.isEmpty()) { ccHint.setText(ccHintStr);//from ww w .j a va 2 s .c o m ccHint.setVisibility(View.VISIBLE); if (animate) { ccHint.setAlpha(0f); ccHint.animate().alpha(1f).setDuration(SHOW_CLING_DURATION).start(); } else { ccHint.setAlpha(1f); } } else { if (animate) { ccHint.animate().alpha(0f).setDuration(SHOW_CLING_DURATION) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { ccHint.setVisibility(View.GONE); } }).start(); } else { ccHint.setAlpha(0f); ccHint.setVisibility(View.GONE); } } } }