Ho un layout simile a questo:progressbar setVisible non funziona
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/menu_background"
>
<ProgressBar
android:id="@+id/aPBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
style="@android:style/Widget.ProgressBar.Inverse"/>
...
</RelativeLayout>
E nel mio metodo onCreate Lo faccio per nascondere la ProgressBar in un primo momento:
LayoutInflater inflater = getLayoutInflater();
RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.achievements_screen, null);
progressBar=(ProgressBar)layout.findViewById(R.id.aPBar);
progressBar.setVisibility(View.INVISIBLE);
Ma la ProgressBar
è ancora visibile per tutto il tempo ... ho anche provato View.GONE
.
quando ho impostato
android:visible="gone"
nel file XML, il ProgressBar
doesnt show up, ma non riesco a farlo apparire con
progressBar.setVisibility(View.Visible);
sembra dovrebbe funzionare può dare un bit metallico idea dove stai usando (aggiungendo) questa vista layout –
ok, l'ho capito usando 'progressBar = (ProgressBar) findViewById (R.id.aPBar);' invece di 'progressBar = (ProgressBar) layout.findViewById (R.id.aPBar); 'ma non ho idea del perché funzioni. im aggiungendo questa vista di layout nel onCreate della mia attività dopo super.onCreate e setContentView – yon