0

ギャラリーを持つ Android アプリケーションがあります。アプリケーションが画面中央で画像ビューを実行する場合、画面の左側からビューを開始するように配置します。

padding、margin、gravity、setSpacing などのすべてのレイアウト パラメータを試してみましたが、それらはすべて、画像の位置を線形レイアウトの左上に設定するために機能しませんでした。

<?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:layout_marginBottom="0dp"
android:orientation="vertical" >

<uk.co.senab.photoview.sample.HackyViewPager
    android:id="@+id/view_pager"
    android:layout_width="match_parent"
    android:layout_height="404dp"
    android:layout_weight="3" />

<RelativeLayout
    android:id="@+id/actionBar"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:orientation="horizontal" >

    <Gallery
        android:id="@+id/gallery1"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_gravity="left|top"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

</RelativeLayout>

4

1 に答える 1

0

1) You need RelativeLayout as parent.

2) Set attributes to your images view

android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"

p.s. show xml code of your layout

于 2013-10-14T08:16:58.150 に答える