0
別のボタンが選択されたときにテキストスイッチャーでテキストを変更するボタンが4つあります。私のスイッチャーでは、テキストをボタンビューの中央に配置したいのですが、 は、ボタンの内側にテキストを配置するのに苦労しているので、これをどうやってできるか知りたいです。 Android ButtonViewを中心としたAndroid TextSwitcher
別のボタンが選択されたときにテキストスイッチャーでテキストを変更するボタンが4つあります。私のスイッチャーでは、テキストをボタンビューの中央に配置したいのですが、 は、ボタンの内側にテキストを配置するのに苦労しているので、これをどうやってできるか知りたいです。 Android ButtonViewを中心としたAndroid TextSwitcher
TextSwitcherが出て現在のテキストをアニメーション化し、中に新しいテキストをアニメーション化します。そう
上のXMLに
private TextSwitche mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
mSwitcher.setFactory(this);
Button nextButton = (Button) findViewById(R.id.one);
nextButton.setOnClickListener(this);
と
public View makeView() {
Button b= new Button(this);
b.setGravity(Gravity.CENTER | Gravity.CENTER_HORIZONTAL);
b.setTextSize(70);
b.setTextColor(Color.RED);
return b;
}
を作成
<Button android:id="@+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="one"
android:textStyle="bold|italic" />
<Button android:id="@+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Switch"
android:textStyle="bold|italic" />
<TextSwitcher android:id="@+id/switcher"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
私はこのコードをテストしていませんが、textSwitcherの詳細については、Documentationをご覧ください。 とAndroid, make text switcher central?
私は私のスイッチャーとビューアファクトを設定しているので、ボタン・ビューの中にテキスト・スイッチャーのテキストをどのように配置するかを知りたいと思っています。 – Shakey