在FrameLayout TextView顺时针动态设置,但我想要逆时针

时间:2015-06-01 13:40:32

标签: android android-framelayout

textview设置从右到左循环但我想要从左到右.....下面是我的代码... Plz帮助...提前感谢

for(int i = 0; i < arr.length; i++)
    {
                    final TextView  v = new TextView(this);

                    v.setText(arr[i]);
                    v.setTag("View " + i);
                    v.setGravity(Gravity.CENTER);

                    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(150, 100);


                    lp.gravity = Gravity.CENTER;
                    lp.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);

                    v.setLayoutParams(lp);
                    angleDeg = i * 360.0f / numViews - 90.0f;
                    float angleRad = (float)(angleDeg * Math.PI / 180.0f);

                    v.setTranslationX(250 * (float)Math.cos(angleRad));
                    v.setTranslationY(250 * (float)Math.sin(angleRad));
                    v.setRotation(angleDeg + 90.0f);  

                    myTextViews[i] = v;
                    main.addView(v);

      }

0 个答案:

没有答案