TextViewとImageViewを含むRelativeLayoutを使用して、独自のボタンを作成できます。
<RelativeLayout android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
onClick="[yourLoginMethod]" >
<TextView android:id="@+id/login_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Log In" />
<ImageView android:id="@+id/login_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/login_text"
android:visibility="gone" />
</RelativeLayout>
次に、どのログインメソッドが呼び出されても、TextViewの内容を変更し、親を右揃えにして、ImageViewの可視性を表示に設定します。
loginText.setText("Logging In...");
LayoutParams params = loginText.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
loginText.setLayoutParams(params);
loginLoading.setVisibility(View.VISIBLE);
そして、ログインが失敗した場合にそれらの変更を元に戻すコードもあります。