我想在另一个活动之上创建一个透明的Activity.
我怎样才能做到这一点?
当应用程序等待服务器响应时,显示加载微调器的最佳方法是什么?
这可以通过编程方式完成吗?这样我就不必在xml文件中添加加载微调器了?
我有一个主要活动,它有简单的按钮和与之关联的监听器.每个按钮都会打开一个新活动(意图).但是,在打开活动时,加载会导致UI冻结需要一些时间.我想通过简单地在它们之间添加一个加载圆(微调器)来避免这种情况.我搜索了很多帖子,但仍然找不到任何东西.
加载圈我的意思是这个
我有以下布局(这里提供了更简单的设计):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main">
<FrameLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hey, badge!"
android:layout_margin="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AAAAA"
android:layout_margin="10dp"
android:textSize="12sp"
android:background="#ff00ff"
android:padding="10dp"
android:layout_gravity="top|end"
/>
</FrameLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我希望将TextView设置为文本"AAAA"以充当Button的徽章,即将其放置在其右上角的按钮上,但事实并非如此.
相反,当我在带有Lollipop的HTC One M7或带有Lollipop的Genymotion Nexus 6上尝试此代码时,屏幕看起来像这样:
当我使用KitKat在Genymotion Nexus 5上尝试相同的代码时,一切看起来都符合预期,即第一个视图(按钮)显示在徽章(textview)下面
有没有人知道这里有什么问题?
谢谢,Deveti