2013-03-20 3 views
1

Я сталкиваюсь с проблемами макета при использовании горизонтальной Scrollview для прокрутки изображения с флажками ниже мой макетAndroid: горизонтальный выпуск Scrollview

<HorizontalScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     > 

     <LinearLayout 
      android:id="@+id/mygallery" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      > 
     </LinearLayout> 
    </HorizontalScrollView> 

Я использую этот Scrollview в виде списка, который находится в другом макете

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/albumsearch" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:background="#FFFFFF" 
    android:orientation="vertical" > 

<ListView 
      android:id="@+id/albumdetails" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"   
      android:background="#FFFFFF" 
      android:paddingBottom="5dp" > 
     </ListView> 
    </LinearLayout> 

ниже макет с моим изображением и флажком

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    android:orientation="vertical" > 

    <CheckBox 
     android:id="@+id/selectedImg" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBottom="@+id/icon" 
     android:layout_centerHorizontal="true" 
     android:layout_marginBottom="72dp" 
     android:layout_marginTop="20dp" 
     android:checked="true" /> 

    <ImageView 
     android:id="@+id/icon" 
     android:layout_width="72dp" 
     android:layout_height="75dp" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" /> 

</RelativeLayout> 

, но когда я запускаю этот код на устройствах небольшого экрана, я вижу только половину изображения, как получить полное изображение, любая помощь приветствуется.

ответ

0

Решено: после изменения моего макета с флажком и ImageView для LinearLayout и использовали weight атрибут

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:gravity="left" 
    android:orientation="vertical" 
    android:layout_weight="1" > 

    <CheckBox 
     android:id="@+id/selectedImg" 
     android:layout_width="wrap_content" 
     android:layout_height="0dp" 
     android:checked="true" 
     android:layout_weight="1" 
     android:gravity="center" /> 

    <ImageView 
     android:id="@+id/icon" 
     android:layout_width="72dp" 
     android:layout_height="0dp"  
     android:layout_weight="1" 
     android:gravity="center" /> 

</LinearLayout> 
Смежные вопросы