Android意味プ Gallery絡み
今回つまったこと
- Gallery内の画像が重なっちゃう
- Gallery内の画像開始位置が顔面センター
まじくそが。
Androidも、俺も糞すぎる。この糞豚野郎。
今回、勢いあまって逆引き本を買ってしまいました。
改訂2版 Android SDK逆引きハンドブック
無くても大丈夫だけど、あったらあったでど忘れしたキーワードとか拾いやすい。
解決編
- Gallery内の画像が重なっちゃう
ポイントはandroid:spacingなわけで、初期値が意味プだから0を入れてやるらしい。なにそれ。
<Gallery android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/hoot_like_user_gallery" android:spacing="0px" android:layout_gravity="left" />
- Gallery内の画像開始位置が顔面センター
たいした話しではなく、適当にマージンとっちまおうぜってこと。
ViewGroup.MarginLayoutParams mp = (ViewGroup.MarginLayoutParams)galleryView.getLayoutParams(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); mp.setMargins(-(metrics.widthPixels / 2), mp.topMargin, mp.rightMargin, mp.bottomMargin);
ほんとまじ、戸田恵梨香に責められまくりたい。