EditText
, Button
및 ListView
과 함께보기가 있습니다. 단추의 onClick()
은 일부 사이트를 구문 분석하지만 (이 부분은 정상적으로 작동합니다), 구문 분석 된 정보를 ListView
에 표시하는 데 시간이 걸리므로 잠시 후 ListView
이 발생하는 위치에 작은 ProgressBar
을 표시하고 싶습니다. 내가 이렇게몇 가지 작업을하는 동안보기에 ProgressBar를 표시하는 방법?
progressBar = (RelativeLayout) findViewById(R.id.progressbar);
을 그리고 매번 내가 ProgressBar
을 보여주고 싶은 : 소스 코드에서
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout1"
android:weightSum="1.0">
<EditText
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight=".86" />
<ImageButton
android:layout_height="match_parent"
android:layout_width="0px"
android:layout_weight=".14" />
</LinearLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="@id/layout1"
android:gravity="center"
android:layout_centerInParent="true"
android:id="@+id/progressbar" >
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@android:style/Widget.ProgressBar.Small" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/layout1">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
가 :
그래서, 내 레이아웃이 추가 (I 여기에서 중요한 부분을 쓰기) : 사용하지 않도록
progressBar.setVisibility(View.VISIBLE);
:
progressBar.setVisibility(View.INVISIBLE);
하지만 이것은 작동하지 않습니다.
어떻게 해결할 수 있습니까?
*하지만 작동하지 않습니다. * -별로 도움이되지 않습니다. 문제가 무엇인지 더 자세히 설명하는 치료? – Luksprog
'ProgressBar'가 표시되지 않습니다. 'ProgressBar' 사소한 일을 추가하지 않고 작업 한 것처럼 작동합니다. – azizbekian
Luksprog와 동의하지만, 나는 당신의 파싱이 블로킹 된 것 같아서 기꺼이 할 것입니다 (그래서 코드는 파싱까지 실행되지 않습니다). 이 문제를 해결할 수있는 방법이 많이 있지만 progressbar 및 asynctask를 검색하는 것이 좋습니다 (이 작업을 수행하는 다른 방법이 있지만 기본적으로 작업을 수행하는 동시에 비 차단 displayprogressbar 메서드를 시작해야합니다. 구문 분석, displayprogressbar에서 반환하기 전에 구문 분석 프로세스 완료 확인). – logray