Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.66 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android: TextView Background Drawable - Allow height of 0?
  2. public class HelloAndroid extends Activity implements View.OnClickListener{
  3.  
  4. TextView btn;
  5.  
  6. @Override
  7. public void onCreate(Bundle savedInstanceState) {
  8.     super.onCreate(savedInstanceState);
  9.     btn = new TextView(this);
  10.     btn.setOnClickListener(this);
  11.     //Put in any drawable of you in here
  12.     btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.restablebg5));
  13.     btn.setHeight(80);
  14.  
  15.     LinearLayout v = new LinearLayout(this);
  16.     v.setOrientation(LinearLayout.VERTICAL);
  17.     v.addView(btn);
  18.     setContentView(v);        
  19.  
  20. }
  21.  
  22. public void onClick(View arg0) {
  23.     btn.setHeight(0);
  24.  
  25. }