Android 앱을 개발 중이며 알아볼 수없는 사소한 문제가 발생했습니다. 사용자가 검색 버튼을 클릭 한 후 진행률 서클을 표시하려고합니다. 하지만 지금까지 작성한 코드로 진행 막대를 만들 수없는 방법이 있습니다.android progress circle이 표시되지 않습니다.
코드 .. 다음과 같습니다
내 조각 클래스에서아래 검색 버튼을 클릭에 대한 코드는 ...
//create a progress dialog circle.
spinner = (ProgressBar) searchByDoctor.findViewById(R.id.progressBar1);
spinner.setVisibility(View.VISIBLE);
spinner.setIndeterminate(true);
List<DocInfoTO> docList = doctorService.findDocBySearchCriteria(docSearchInputTO);
if(docList != null && docList.size() > 0)
{
//stop the progress cirlce as soon as we get the results.
spinner.setVisibility(View.GONE);
spinner.setIndeterminate(false);
List<SearchResultDoctorRowItem> rowItems = new ArrayList<SearchResultDoctorRowItem>();
for(DocInfoTO doc : docList)
{
rowItems.add(YourDocUtil.setDoctorRowItemDto(doc));
}
XML은이처럼
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/android">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/enter_doc_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_horizontal"
android:paddingTop="200dp"/>
<EditText
android:id="@+id/editText1"
android:layout_width="238dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginTop="20dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="@string/doctor_Name" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" >
<LinearLayout
android:id="@+id/footerSearch"
style="?metaButtonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
>
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/searchDoc"
/>
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"/>
</FrameLayout>
findDocBySearchCriteria 메서드를 호출하면 서버가 손상 될 수 있으므로 실제로는 조금 길어집니다. 나는 적어도 spinner 회전을 볼 수 있도록 확인을 위해서 Thread.sleep (7000)을 추가하려고 시도했다. 그러나 나는 나를 도왔다. – Jack
하나의 빌드에 대해 spinner.setVisibility (View.GONE) 주석 처리를 시도해보십시오. – DrkStr
그 이유는'doctorService.findDocBySearchCriteria (docSearchInputTO); '를 호출하고 같은 스레드에서 스피너를 호출했기 때문입니까? – Jack