آموزش های این وب سایت به صورت رایگان در دسترس است. اطلاعات بیشتر
بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]

زاویه دادن به view ها

mhk  11 سال پیش  11 سال پیش
0 0

سلام به اساتید

ایا میشه به view ها یا دکمه ها زاویه داد . مثلا یک دکمه رو کج گذاشت توی صفحه .

 برای این سوال 1 پاسخ وجود دارد.
پاسخ به سوال 
Spirit  11 سال پیش
+4 0

میشه با Animation این کار رو انجام داد :

 public class RotatedViewActivity extends Activity  
{
//The animation that rotates the Button and the TextView
Animation animation;

//Some View elements to be rotated
TextView tv;
Button bt;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

tv = (TextView) findViewById(R.id.tv_test);
bt = (Button) findViewById(R.id.bt_button);

//Initialize the Animation object
animation = new RotateAnimation(45.0f, 45.0f, 0, 0);
//"Save" the results of the animation
animation.setFillAfter(true);
//Set the animation duration to zero, just in case
animation.setDuration(0);

//Assign the animation to the TextView
tv.setAnimation(animation);
//Assign the animation the the Button
bt.setAnimation(animation);
}
}

منبع


پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .