Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无边框的ProgressBar对话框_Android_Progress Bar_Android Progressbar - Fatal编程技术网

Android 无边框的ProgressBar对话框

Android 无边框的ProgressBar对话框,android,progress-bar,android-progressbar,Android,Progress Bar,Android Progressbar,我正在Android中显示一个ProgressBar,如下所示: 但是在进度条周围有一个白色边框。如果我不想显示任何边框怎么办? i、 例如,只有进度条圆圈和文本应显示在进度条对话框中 如何显示进度条,如下所示(在下图中搜索时如何显示进度对话框:) 更新: 我没有找到解决方案,但我认为应该有一些技巧,以这种方式显示进度条对话框。我的意思是说应该有一种方法可以扩展styles.xml中的一些样式。请大家关注这个问题并帮助我显示这样的对话框。经过一些实验,我得到了以下结果: <?xml v

我正在Android中显示一个
ProgressBar
,如下所示:

但是在进度条周围有一个白色边框。如果我不想显示任何边框怎么办?

i、 例如,只有进度条圆圈和文本应显示在进度条对话框中

如何显示进度条,如下所示(在下图中搜索时如何显示进度对话框:)

更新:
我没有找到解决方案,但我认为应该有一些技巧,以这种方式显示进度条对话框。我的意思是说应该有一种方法可以扩展styles.xml中的一些样式。请大家关注这个问题并帮助我显示这样的对话框。

经过一些实验,我得到了以下结果:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="my_style" parent="@android:style/Theme.Dialog" >
        <item name="android:windowBackground">@null</item>
    </style>
</resources>

@空的
如果我将此主题用作
活动的样式
,则不会得到框架。
如果你在
对话框中使用它,你就不会得到框架了。

你还需要一些想法吗?我在我的应用程序中实现了相同的东西,但不是作为一个对话框,我有两个相互重叠的布局。然后通过设置可见性
.setVisibility()
,在两个布局之间切换。至于实际进度条本身,我使用以下方法:

编辑:这是我的整个XML文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="@drawable/background"> 
     <RelativeLayout android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:id="@+id/search_header" android:background="@drawable/header">
           <!-- Some things I need for the header (title, etc) -->
     </RelativeLayout>  
    <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" 
     android:id="@+id/spinner_layout" android:layout_below="@+id/search_header" 
     android:layout_centerHorizontal="true" android:layout_centerVertical="true">
     <ProgressBar android:id="@+id/title_progress_bar"
   style="?android:attr/progressBarStyleSmallTitle"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_alignParentRight="true"
   android:layout_centerVertical="true"
   android:visibility="visible"
   android:indeterminateOnly="true"/>
  <TextView android:layout_width="wrap_content" 
   android:layout_height="wrap_content" 
   android:id="@+id/loading_label" android:text="Loading..." 
   android:layout_gravity="center_vertical" android:layout_marginLeft="5dip">
  </TextView>
 </LinearLayout>
 <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" 
  android:layout_below="@+id/search_header" android:id="@+id/list_contents">
  <!-- Stuff you want to show after returning from the AsyncTask -->
 </RelativeLayout>    
</RelativeLayout>
然后做我必须做的事情,
onPostExecute()
我有:

@Override
protected void onPostExecute(Cursor cursor){
 findViewById(R.id.list_contents).setVisibility(View.VISIBLE);
 findViewById(R.id.spinner_layout).setVisibility(View.GONE);
}

你能给我一个方向吗?您知道此对话框中使用的STLE是什么吗?最有可能的是,该样式将在ProgressDialog类或它所属的类中定义。一旦您知道可以使用STL和attr XML并检查要覆盖的属性。哦,差点忘了:1。如果你需要的代码,我在我的电脑上,虽然它是可以通过gitweb。。。2.我会看一看小部件本身的代码,大多数技术只是使用一些绘图,你可以像TripAdvisor应用程序一样在你自己的小部件中使用。3.最后但并非最不重要;-)尝试使用android:background=“transparent”你可以使用这个链接,你可以编写你想要的基本链接,我希望这可以帮助你Hi thanx让我知道更多的方法,但我仍然需要实现相同的方法,我不完全是你的想法,你能为相同的布局发布整个XML文件吗??
@Override
protected void onPostExecute(Cursor cursor){
 findViewById(R.id.list_contents).setVisibility(View.VISIBLE);
 findViewById(R.id.spinner_layout).setVisibility(View.GONE);
}