2012-07-18 104 views
0

我是新来的Android应用程序,使用TextView的设置高度和宽度,但我因此未知道如何设置X,在Android应用程序的y值,请帮我如何在android应用程序中设置x,y值?

由于提前

Here i tried: 

<TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Select Your country"/> 
+0

“x和y”是什么意思? – Jin35 2012-07-18 10:18:45

+0

类似iphone应用程序的x和y值 – SampathKumar 2012-07-18 10:19:47

+0

android应用程序没有x,y值ahh – SampathKumar 2012-07-18 10:20:38

回答

0

你有如果你想动态设置宽度和高度,可以在android中为textview或任何视图设置布局参数。

+0

感谢您的回复 – SampathKumar 2012-07-18 10:24:10

0

您只能在AbsoluteLayout中使用x和y位置。 像这样

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 
     <Button android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:id="@+id/button1" 
      android:layout_x="104dp" 
      android:text="Button" 
      android:layout_y="54dp"></Button> 
</AbsoluteLayout> 

见其他布局中this网站

+0

感谢您的回复 – SampathKumar 2012-07-18 10:24:15

0

如果我M右,美要设置视图的高度和宽度(说的TextView) 您可以在XML布局这样做。 例如:

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="DESIRED WIDTH" 
    android:layout_height="DESIRED HEIGHT" 
    android:text="Select Your country"/> 

只是设置高度和宽度的ur值。

或者如果u要设置在运行时ü可以那样做

TextView textView =(TextView)findViewById(R.id.textView1); 
textView.setWidth(DESIRED WIDTH); 
textView.setHeight(DESIRED HEIGHT); 

所需的高度&所需的宽度是由你。

希望它有帮助。

+0

感谢您的回复 – SampathKumar 2012-07-18 11:11:39

+0

所以这就是你要找的? – 2012-07-18 11:13:06

相关问题