我想在连接到服务器时显示图像(我正在开发 SIP 应用程序)。我做了这个(创建了一个带有文本视图和图像的 XML 文件[connected.xml]),但是有一个 FC:
public void onRegistrationDone(String localProfileUri, long expiryTime) {
updateStatus("Registered to server.");
Log.d("SUCCEED","Registration DONE");
setContentView(R.layout.connected);
}
然后我想在连接和断开连接时添加图像......我该如何解决这个问题?非常感谢。
编辑:XML:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView
android:id="@+id/sipLabel"
android:textSize="20sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ViewFlipper
android:id="@+id/flipper"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/disconnected" android:src="@drawable/disconnected" android:layout_below="@id/sipLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="0.35" android:gravity="center"
/>
</RelativeLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/connected" android:src="@drawable/connected" android:layout_below="@id/sipLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="0.35" android:gravity="center"
/>
</RelativeLayout>
</ViewFlipper>
</RelativeLayout>