RelativeLayout
とを含むで構成されるギャラリー アイテムがありImageView
ますTextView
。(下の私の傑作を見てください)
アクティビティの開始時に、1 つのギャラリー アイテムが画面のすべてのスペースを占有し、画像が左側で失われ、テキストビュー (青いバナー) が長すぎます。画像の幅に応じて、複数のアイテムを並べて表示したい。
画像はサーバーからロードされた後に置き換えられるため、アクティビティを開始/レイアウトするときに画像の幅が正確にどれくらいになるかわかりません。
RelativeLayout
画像が読み込まれてビューに配置された後、画像の幅を画像の幅に合わせたいと思います。
getLayoutParams()
ギャラリーの ListAdapter 内のメソッドを既に試しましたが、これは ANR につながり、結果はまったくありません。
私のギャラリーアイテムのレイアウトは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_wrap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/item_margin"
>
<ImageView
android:id="@+id/item_image"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
/>
<TextView
android:id="@+id/item_name"
android:layout_width="fill_parent"
android:layout_height="@dimen/item_title_height"
android:layout_alignParentBottom="true"
android:text="Some longer title so you can see how the text behaves"
android:singleLine="true"
android:gravity="left|center_vertical"
android:paddingLeft="10dip"
android:background="@drawable/title_gradient_grey"
/>
</RelativeLayout>
画像が挿入された後に再レイアウトする方法はありますか?