일부 서적에 따라 다음과 같은 설정이 있습니다. 그러나 앱이로드 될 때 진행률 막대가 표시되지 않습니다.시작시 진행 표시 줄이 표시되지 않습니다.
MainActivity.javapublic class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText et;
private ImageView iv;
private ProgressBar pb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b = (Button)findViewById(R.id.button);
et = (EditText) findViewById(R.id.edittext);
b.setOnClickListener(this);
iv = (ImageView)findViewById(R.id.image);
pb = (ProgressBar)findViewById(R.id.progressbar);
pb.setVisibility(View.VISIBLE);
}
@Override
public void onClick(View v){
switch(v.getId()){
case R.id.button:
//String input = et.getText().toString();
//Toast.makeText(MainActivity.this, input,Toast.LENGTH_SHORT).show(); //**
//pb.setVisibility(View.VISIBLE);
break;
default:
break;
}
}
내가이 링크를 참조
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text_view"
android:text="This is a text"
android:gravity="center"
android:textSize="24sp"
android:textColor="#00ff00"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="button"
android:textAllCaps="false"
android:id="@+id/button"
/>
<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Type sth here :)"
android:maxLines="2"
/>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/rose"
/>
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/progressbar"
android:indeterminate="true"
android:layout_centerInParent="true"
/>
</LinearLayout>
내 activity_main.xml : ... 바는 간단하지 않습니다 내 경우에는 작동하지 않습니다 아직 Android progressBar not showing을하지만, 표시 ...
이상한. xml 파일의 끝에 " LinearLayout>"여야합니다, 나는 위에 추가하려고했지만 어떻게 든 나타나지 않습니다. –
아 ... 왜 아래로 투표 르 ?? 그래서 낙심 ... 같은 종류에서 그것을 차별화 할만큼 고유 한 만큼이 질문에 도움이 생각 ... StackOverflow 정말 downvoting 사람들이 downvote 때, 이유와 같은 더 엄격한 제어해야한다 .. –