我需要2种在Android中显示垂直标签的方法:
我是否需要为这两种情况开发自定义小部件(一种情况),我可以使TextView以这种方式呈现,如果我需要完全自定义,那么这样做的好方法是什么?
我想创造像下面这样的东西.

通过使用LinearLayout和TableLayout.但我坚持使用垂直文本.它比旋转后需要的空间更多.
fllowing是XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/tv_CONSEQUENCES"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:rotation="-90"
android:text="CONSEQUENCES"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) 有没有办法使用XML布局文件显示View,例如TextView?我知道你可以使用活动中的代码来旋转视图,但是有没有办法用布局来做呢?
我有一个EditText,它通常显示与屏幕X轴平行.我想倾斜地显示它(与横轴成45度左右).是否可以在Android中执行此操作.请指导我一个方向,以便我可以尝试.
在pawelzeiba的答案中得到两个链接之后,我继续解决这个问题,但再次陷入困境,所以我又提出了另一个问题.这是链接.
正如Gunnar Karisson所说,在Android 3.0中引入的View类中有一个setRotation()方法,但我无法使用它,因为我的应用程序应该适用于Android 2.1版本.
所以请帮我解决这个问题.
海兰!
我在android上创建了一个按钮,文本看起来像这样:http:landscape//i51.tinypic.com/2u4oaww.png
它看起来像是因为活动处于模式状态.我接下来想要的是旋转文本它看起来正常的按钮,但我可以弄清楚如何做到这一点.
我试过动画,像这样:
在res/anim/myanim.xml:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="180"
android:pivotX="50%"
android:duration="0" />
takePhoto = (Button) findViewById(R.id.btnPhoto);
takePhoto.setText(t);
RotateAnimation ranim = (RotateAnimation)AnimationUtils.loadAnimation(this, R.anim.myanim);
ranim.setFillAfter(true);
takePhoto.setAnimation(ranim);
Run Code Online (Sandbox Code Playgroud)
但是当我这样做时,我button不再出现在屏幕上了!有人能告诉我怎么能解决这个问题?谢谢
编辑:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:layout_weight="1.0">
<SurfaceView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/surface_camera"
/>
</LinearLayout>
<LinearLayout android:layout_width="90dip"
android:layout_height="fill_parent">
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/btnPhoto"
android:text="Take Photo"
android:layout_gravity="bottom|left"
/>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)