ViewFlipper 的问题
我有一个包含 ViewFlipper 的 XMl 文件,并且希望在 3 秒后显示下一个视图(在 viewflipper 中),但在此时间段之后它不会显示: XML:
<?xml version="1.0" encoding="UTF-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
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">
<TextView android:id="@+id/sipLabel" android:textSize="20sp"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<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" android:visibility="visible" />
</RelativeLayout>
<RelativeLayout 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" />
<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" android:visibility="visible" />
</RelativeLayout>
</ViewFlipper>
JAVA 代码:
public void onRegistrationDone(String localProfileUri, long expiryTime)
{
updateStatus("Registered to server.");
Log.d("SUCCEED", "Registration DONE");
final ViewFlipper flipper = (ViewFlipper) findViewById(R.id.flipper);
flipper.postDelayed(new Runnable()
{
public void run()
{
flipper.showNext();
}
}, 3000);
}
有什么问题吗?为什么下一个视图不显示?
感谢您的帮助。
i have an XMl file that includes a ViewFlipper, and want to show the next view(in the viewflipper) after 3 seconds, but it doesn't shows after this period:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
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">
<TextView android:id="@+id/sipLabel" android:textSize="20sp"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<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" android:visibility="visible" />
</RelativeLayout>
<RelativeLayout 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" />
<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" android:visibility="visible" />
</RelativeLayout>
</ViewFlipper>
JAVA code:
public void onRegistrationDone(String localProfileUri, long expiryTime)
{
updateStatus("Registered to server.");
Log.d("SUCCEED", "Registration DONE");
final ViewFlipper flipper = (ViewFlipper) findViewById(R.id.flipper);
flipper.postDelayed(new Runnable()
{
public void run()
{
flipper.showNext();
}
}, 3000);
}
What is the problem ? why the next view doesn't shows ?
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试运行一个线程:
您可以以毫秒为单位设置 FLIP_INTERVAL。
try this insted of runnig a thread:
you can set the FLIP_INTERVAL in milisecond.