レイアウトに TextView を配置する方法は、コードから TextView の中心に依存しますか?デフォルトでは、左上の角度に応じて作成できます。メソッド setGravity(Gravity.CENTER_HORIZONTAL) は役に立ちません。
編集
TextViews を円で配置したい。私が使用するのはRelativeLayoutです。layot TextViews 内で、角度ステップを使用して for ループに配置します。ここにいくつかのコード
for (int i = 0; i < 62; i++) {
TextView word = new TextView(context);
word.setTextSize(13);
// word.setGravity(Gravity.CENTER_HORIZONTAL);
word.setTextColor(Color.BLACK);
RotateAnimation rotateAnimation = new RotateAnimation(0,
angle.get(i), 0, (float) (textHeight * 0.9 + rotateCircle));
rotateAnimation.setFillAfter(true);
rotateAnimation.setDuration(100);
rotateAnimation.setStartOffset(100);
word.setAnimation(rotateAnimation);
word.setGravity(Gravity.CENTER);
word.setPadding(10, 10, 10, 10);
RelativeLayout.LayoutParams layoutparams = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutparams.leftMargin = Math.round(x_coords.get(i));
layoutparams.topMargin = (int) (Math.round(y_coords.get(i)
- textHeight * 0.9 - rotateCircle));
textviews.add(word);
words_layout.addView(word, layoutparams);
}