追記です。
どうやらProgressBarを追加したのが原因のようです。ProgressBarのHeightを1dpにしたところ治りました。
しかし、1dpにしたのでは当然表示されないので意味がありません。
ProgressBarをvisibleで表示→非同期で画像をURLからロードして終わったらvisible=goneの画像を戻してprogressbarを隠す、という風にしています。
xmlの書き方とか処理の順番とかそういったことで何とかなりそうな気がするので、現在調べています。
原因に全く心当たりがないので質問します。
AndroidでListViewからタップしてintentで画面遷移をするのですが、その時に何故か少しスクロールした状態で遷移します。
どのセルをタップしてもだいたい250dp以上遷移した状態で始まり、動作としては問題ないのですが、どう考えてもおかしいので修正したいです。
しかし、全く心当たりがありません。以前はこのようなことはなかったのですが、最近アプリをテストしていたところ、気がついたらこうなっていたので、何をいじったらこうなったか?というのはイマイチ不明です。
画面遷移はMainActivityからsetOnItemClickListenerで飛んでいます。
ImageCache.clearCache();
Item item = mAdapter.getItem(i);
Intent intent = new Intent(getApplication(), ShopDetailActivity.class);
LocationParcelable parcelable = new LocationParcelable();
parcelable.mLocation = location;
intent.putExtra("ItemSerializable", item);
intent.putExtra("location", parcelable);
int requestCode = RESULT_SUBACTIVITY;
startActivity(intent);
こんな感じです。得に何の変哲もないintentのような気がします。
問題のShopDetailActivityのxmlはかなり入れ子になっています。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="top"
tools:context="hoge.ShopDetailActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout><ProgressBar android:id="@+id/progressbar_shopimage" android:layout_width="match_parent" android:layout_height="300dp" android:elevation="6dp" android:background="#000000" /> <ImageView android:id="@+id/shopImageView" android:layout_width="match_parent" android:layout_height="300dp" android:background="#000000" android:elevation="6dp" android:visibility="gone" android:contentDescription="@string/imagedesc"/> <LinearLayout android:orientation="vertical" android:background="#F2EBDB" android:layout_width="match_parent" android:layout_height="match_parent"> //ここに3つくらいListViewが入っています </LinearLayout> </LinearLayout> </ScrollView> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <View android:background="@drawable/background_shadow" android:layout_width="match_parent" android:layout_height="1dp" /> <LinearLayout android:background="#EDE6D6" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" android:orientation="horizontal" > //ここにボタンが2個、下部に固定されるような形にしています </LinearLayout> </LinearLayout>
大枠はこんな感じです。
何かこう、そういうような現象が起こるようなものに心当たりのある方はどうかよろしくお願いします。
ShopDetailActivity
http://yasato.sakura.ne.jp/sda.txt
回答3件
あなたの回答
tips
プレビュー