TextView with border stroke

Hi. I want a textView with a gray background, white text and a red border stroke.
In the code below I get the border and text but the background becomes transparent.
What is the right way to achieve this?

import android.app.Activity;
import android.widget.FrameLayout;
import android.graphics.Color;
import android.view.ViewGroup.LayoutParams;
import android.view.Gravity;
import android.R;
import android.graphics.Color;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.graphics.drawable.ShapeDrawable; 
import android.graphics.drawable.shapes.RectShape; 
import android.graphics.Paint.Style;

Activity act;
FrameLayout fl;

  public void onStart() {
  act = this.getActivity();

  ShapeDrawable sd = new ShapeDrawable(); 
  sd.setShape(new RectShape()); 
  sd.getPaint().setColor(Color.RED); 
  sd.getPaint().setStyle(Style.FILL);
  sd.getPaint().setStrokeWidth(10f); 
  sd.getPaint().setStyle(Style.STROKE); 
   
  TextView tv = new TextView(act);  
  tv.setLayoutParams(new RelativeLayout.LayoutParams(500, 100));
  tv.setBackground(sd);
  tv.setBackgroundColor(Color.GRAY);
  // tv.setBackground(sd);
  tv.setX(width/2-250);
  tv.setY(height/2);
  tv.setGravity(Gravity.CENTER);
  tv.setTextColor(Color.WHITE);
  tv.setTextSize(32);
  tv.setText ("Hello world");  
   
  fl = (FrameLayout)act.findViewById(R.id.content);
  FrameLayout.LayoutParams params1 = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER);
  fl.addView(tv);
}

void setup(){
  background(Color.BLUE);
}

Well, here’s how.

import android.app.Activity;
import android.widget.FrameLayout;
import android.graphics.Color;
import android.view.ViewGroup.LayoutParams;
import android.view.Gravity;
import android.R;
import android.graphics.Color;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.graphics.Paint.Style;
import android.graphics.drawable.GradientDrawable;

Activity act;
FrameLayout fl;

public void onStart() {
  act = this.getActivity();

  GradientDrawable sd = new GradientDrawable(); 
  sd.setShape(GradientDrawable.RECTANGLE); 
  sd.setColor(Color.GRAY); 
  sd.setStroke(8, Color.RED); 

  TextView tv = new TextView(act);  
  tv.setLayoutParams(new RelativeLayout.LayoutParams(500, 100));
  tv.setBackgroundColor(Color.GRAY);
  tv.setBackground(sd);
  tv.setX(width/2-250);
  tv.setY(height/2);
  tv.setGravity(Gravity.CENTER);
  tv.setTextColor(Color.WHITE);
  tv.setTextSize(32);
  tv.setText ("Hello world");  

  fl = (FrameLayout)act.findViewById(R.id.content);
  FrameLayout.LayoutParams params1 = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER);
  fl.addView(tv);
}

void setup() {
  background(Color.BLUE);
}