Я пытаюсь установить видимость моего изображения, кнопки и текста. Но они все еще там, когда я запускаю программу. Я попробовал View.GONE, но просто удалю все текстовое изображение, изображение и кнопку. Но я просто хочу спрятаться, а потом показать.View.Invisible - изображения остаются на экране
list.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3)
{
if(baglanti.DegerDogruMu() == true)
{
ekvar = true; **// If true there is an attachment**
gelen = baglanti.EkinIsmi();
}
else
{
ekvar = false; **// False = no attachment**
}
}
Затем я поставил результат в намерении.
final Intent intent = new Intent(ListeleActivity.this, GoruntuleActivity.class);
intent.putExtra(ekvarmı, ekvar);
startActivity(intent);
И другая активность называют этот метод с добавлением "ekvar"
public void ListOnClicklendiginde(final int position , ArrayList<String> bodyliste , ArrayList<String> kimdenlist , ArrayList<String> konulist, boolean ekvarmı , ArrayList<String> ekinismi)
{
**// First I hide the "attachment things"**
dosyaAdi.setVisibility(View.INVISIBLE);
atacResim.setVisibility(View.INVISIBLE);
ekButton.setVisibility(View.INVISIBLE);
**// If there is an attachment then visible the things. (I debug for the no attachment email and it fall the false so the statement is working ok)**
if(ekvarmı == true)
{
dosyaAdi.setVisibility(View.VISIBLE);
atacResim.setVisibility(View.VISIBLE);
ekButton.setVisibility(View.VISIBLE);
}
else
{
dosyaAdi.setVisibility(View.INVISIBLE);
atacResim.setVisibility(View.INVISIBLE);
ekButton.setVisibility(View.INVISIBLE);
}
}
XML:
<RelativeLayout
android:id="@+id/ekTablo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_x="8dp"
android:layout_y="102dp" >
<ImageView
android:id="@+id/imageViewAttachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_email_attachment" />
<TextView
android:id="@+id/dosyaAdi"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="@+id/imageButtonEkIndir"
android:layout_width="50dp"
android:layout_height="16dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/dosyaAdi"
android:src="@drawable/ic_indir" />
</RelativeLayout>
красные квадраты На рисунке они имеют скрыть
Где вы пытаетесь выполнить код, приведенный выше? – CommonsWare
В элементе listview onClick. Фактически Элемент списка OnClick вызывает метод, который этот код использует в этом методе – Merve
Этот код выглядит хорошо, View.Gone полностью удалит представление. Вы должны использовать View.Visible и View.Invisible. Покажите еще один код, как вы используете onClick в listview. –