私のListViewの行レイアウトをビルドして問題がある。 ImageViewの可視性を変更した後でTextviewが消える
は、現在、私のレイアウトは次のようになります。XML:
:今、私はこの結果を得るandroid:visibility="gone"
から
imageView_albumart
の可視性を変更したいとき
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout_ROW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
>
<ImageView
android:id="@+id/imageView_albumart"
android:layout_alignParentTop="true"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginRight="5dp"
android:background="@color/black"
android:visibility="visible"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/txt_titel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/txt_artist"
android:layout_alignTop="@+id/imageView_albumart"
android:layout_toRightOf="@+id/imageView_albumart"
android:singleLine="true"
android:text="Titel"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="18dp"
android:textSize="17dp"
android:layout_toLeftOf="@+id/imageView_eq_animation"
android:layout_alignLeft="@+id/txt_artist"
android:layout_alignStart="@+id/txt_artist" />
<TextView
android:id="@+id/txt_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView_albumart"
android:layout_marginBottom="16dp"
android:layout_toRightOf="@+id/imageView_albumart"
android:text="Artist"
android:singleLine="true"
android:textSize="13dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_toLeftOf="@+id/imageView_eq_animation" />
<ImageView
android:id="@+id/imageView_eq_animation"
android:layout_width="30dp"
android:layout_height="70dp"
android:src="@drawable/ic_equalizer1_white_36dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="gone"
android:layout_alignParentLeft="@+id/txt_artist"
android:layout_alignBottom="@+id/imageView_albumart" />
<TextView
android:id="@+id/txt_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:singleLine="true"
android:textSize="10dp"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_below="@+id/txt_titel"
android:layout_alignParentRight="true" />
</RelativeLayout>
私のフォーマットの問題はどこにありますか?私はちょうどimgAlbumartを隠して、TitleとArtist TextViewsが単独で存在するようにしたい。
したい場合は、 "目に見えない" 設定の視認性を試してみては画像を隠すがテキストは同じ位置にとどまる。 – danypata
いいえ、私のtextviewsはalbumartがそこにないときに左に揃う必要があります。私はそれを不可能にすると、albumartは見えませんが、textviewsは同じ位置にあります。それは私が欲しいものではありません –
タイトル** textview **はImageViewに依存しますpositon textview 'layout_alignBottom'と' layout_toLeftOf'のプロパティを参照してください。そうでなければ 'LinearLayout'を使用してください。 – Yugesh