title: How to make buttons automatically scale down, when screen size decrease?
body: <p>Hi I've been tryin to  figure this out but I can't. I have this button</p>
  
  <pre><code>&lt;Button android:layout_alignLeft="@+id/button1" android:layout_below="@+id/button2"                
  android:id="@+id/button3" 
  android:layout_width="235dp" 
  android:text="@string/spire"
  android:layout_gravity="center_horizontal"
  android:layout_height="wrap_content" 
  &gt;
  </code></pre>
  
  <p>When this button appears on smaller screen how can i make it the button also scale own smaller? Thanks!</p>
  
  <p>EDIT: Okay so heres the new code. But I'm unsure of how to make the edit function work? do i have import something?</p>
  
  <pre><code>import android.app.Activity;
  import android.net.Uri;
  import android.os.Bundle;
  import android.preference.PreferenceManager;
  import android.util.DisplayMetrics;
  import android.view.View;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.widget.Button;
  public void getDisplay(){
      SharedPreferences pref =  PreferenceManager.getDefaultSharedPreferences(this);
      DisplayMetrics metrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(metrics);
          switch(metrics.densityDpi){
          case DisplayMetrics.DENSITY_LOW:
              edit.putInt("SIZE", 12).commit();
              edit.putInt("POSITION", -8).commit();
              break;
          case DisplayMetrics.DENSITY_MEDIUM:
              edit.putInt("SIZE", 16).commit();
              edit.putInt("POSITION", -6).commit();
              break;
          case DisplayMetrics.DENSITY_HIGH:
              edit.putInt("SIZE", 25).commit();
              edit.putInt("POSITION", 8).commit();
              break;
          case DisplayMetrics.DENSITY_XHIGH:
              //edit.putInt("SIZE",35).commit();
              //edit.putInt("POSITION",30);
              break;
          }
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      goHereButton  = (Button) findViewById(R.id.button1);
      goHereButton.setWidth(20);
      goHereButton.setOnClickListener(new View.OnClickListener() 
      {
         public void onClick(View arg0) 
         {
         Intent i = new Intent(UMassGuide.this, DirectionsScreenActivity.class);
         startActivity(i);
         }
      });
  </code></pre>
  
  <p>Also what do i do the xml file? do i delete the width? </p>