HorizontalScrollviewのコンテンツが動的に更新されないという問題に直面しています。初めて以下の関数を呼び出すと、scrollviewの内容が正しく設定されました(onCreateから呼び出されました)。しかし、次回以降、レイアウトは更新されません(バックグラウンドサービスでいくつかの新しいダウンロードが行われた後、基本的に関数を呼び出す)。 playlist_scrollは、(partial_main_playlistから膨らませた)アイテムが追加されるLinearLayout playlist_contentを持つHorizontalScrollViewです。Android:HorizontalScrollviewのコンテンツが動的に更新されない
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/playlist_row"
android:clickable="true"
android:onClick="playlistClicked"
android:background="@color/colorDefaultBg">
<LinearLayout
android:id="@+id/playlist_row_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/resource_row_margin"
android:orientation="horizontal">
<TextView
android:id="@+id/playlist_tv"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:textAlignment="center"
android:ellipsize="marquee"
android:maxLines="1"
android:textStyle="bold"
android:gravity="center"
android:layout_gravity="center_vertical"
android:text="Playlist"
android:textColor="@color/colorDefaultText"
android:textSize="@dimen/playlist_scroll_title_font" />
<ImageView
android:id="@+id/playlist_status"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="0.1"
android:layout_gravity="end"
android:gravity="center"
android:scaleType="center"
android:visibility="invisible"
android:src="@drawable/shuffle"/>
</LinearLayout>
</LinearLayout>
We have referred the answer here and implemented the above code
setPlaylistNameScroll方法は、我々はGoogleドキュメントに読んだ本
public void onReceiveResult(int resultCode, Bundle resultData) {
String error;
switch (resultCode) {
case DownloadService.STATUS_RUNNING:
media_syncing = true;
Log.d(TAG, "DownloadService.STATUS_RUNNING");
break;
case DownloadService.STATUS_FINISHED:
Log.d(TAG, "DownloadService.STATUS_FINISHED");
setPlaylistNameScroll(databaseHandler.getDevicePlaylists(device_id, playlist_ordering));
break;
case DownloadService.STATUS_ERROR:
media_syncing = false;
error = resultData.getString(Intent.EXTRA_TEXT);
Log.d(TAG, "DownloadService.STATUS_ERROR " + error);
break;
case DownloadService.STATUS_STOPPED:
media_syncing = false;
error = resultData.getString(Intent.EXTRA_TEXT);
Log.d(TAG, "DownloadService.STATUS_STOPPED " + error);
break;
}
}
コード内に水平スクロールビューについて言及したことはありません。 – chandil03
@ chandil03申し訳ありませんが、playlist_scrollはHorizontalScrollViewです。ここにはアイテムを追加するLinearlayoutのplaylist_contentがあります。私の編集した質問を見てください。 –
ダウンロードコードはどこにありますか?またはscrollView内のlinearLayout内のコンテンツを更新するコード。 – chandil03