0

当用户单击按钮时,如何增加 TextView 的大小?

4

3 回答 3

2

在 on click 方法中使用以下代码

yourtextview.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);

试一试,看看它是否有效。

于 2013-02-16T08:54:23.683 回答
0

我可能会通过使用 TextView 大小属性来做到这一点。

在按钮的 onClick 中,您可以调用 setTextSize(int,float) 属性来增加或减少大小。

您可能还需要一个变量来根据值增加大小,然后在变量变为 5 后,您可以将大小减小回原始大小

希望这可以帮助。

于 2013-02-16T07:18:58.427 回答
-1
public class Zoom extends Activity
{
private String productName;

public void onCreate(Bundle savedInstanceState)
 {

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                            WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.zoom);

        Intent intent = getIntent();
        productName = intent.getStringExtra("ChoosenMed");

        TextView productNameTextView=(TextView)findViewById(R.id.prodcutNameZoomTextView);
  productNameTextView.setText(productName);

 }
}
于 2013-02-16T05:53:56.030 回答