ボタンのテキストの向きを変更して、横ではなく縦に書くにはどうすればよいですか?
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.10"
android:text="Previous" />
出来ますか?
ボタンのテキストの向きを変更して、横ではなく縦に書くにはどうすればよいですか?
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.10"
android:text="Previous" />
出来ますか?
これを試してテストしましたが、まったく問題なく動作しています。
public class buttonCustom extends Button{
String s="";
public buttonCustom(Context context) {
super(context);
}
public buttonCustom(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public buttonCustom(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
public void setText(CharSequence text, BufferType type) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
for(int i=0;i<text.length();i++)
{
if(s==null)
s="";
s= s+String.valueOf(text.charAt(i))+ "\n";
}
super.setText(s, type);
}
}
ボタン クラスをオーバーライドし、setText 関数をオーバーライドする
私はそれを自分で修正しました。layout-land という名前の別のフォルダーを作成し、そこに別の XML ファイルを配置して処理します。これで、両方のレイアウトが正常に表示され、属性にハードコーディングされた重みを使用できるようになりました。