2

我有这个布局,因为没有显示horizo​​ntalscrollview: 基本上在第一个容器有两个儿童布局,第一个是固定的,第二个应该水平滚动但是第二个没有出现。android-linearlayout在horizo​​ntalscrollview内不起作用

的@绘制/ disattivato包含:

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<gradient 
      android:startColor="#333333" 
    android:endColor="#000000" 
    android:type="radial" 
    android:gradientRadius="500"/> 

    <stroke 
       android:dashGap="10px" 
       android:dashWidth="10px" 
       android:width="1dp" 
       android:color="#ababb2" /> 
</shape> 

这是我的布局:

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="horizontal" > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:orientation="vertical" 
      android:weightSum="8" > 

       <TextView 
        android:id="@+id/tv1" 
        android:layout_width="fill_parent" 
        android:layout_height="0dip" 
        android:layout_weight="1" 
        android:background="@drawable/backgroundbutton" 
        android:gravity="center" 
        android:text="kick11" 
        android:textColor="#000000" 
        android:textSize="8pt" 
        android:textStyle="bold" /> 

      other textviews... 

    </LinearLayout> 

     <HorizontalScrollView 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:fillViewport="true" > 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" 
       android:weightSum="8" > 

          <LinearLayout 
           android:layout_width="fill_parent" 
           android:layout_height="0dip" 
           android:layout_weight="1" 
           android:orientation="horizontal" > 

           <ImageView 
            android:id="@+id/im11" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:adjustViewBounds="false" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im12" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im13" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im14" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im15" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im16" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im17" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im18" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im19" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im110" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im111" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im112" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im113" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im114" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im115" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/im116" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/buf" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/buf1" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/buf2" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/buf3" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/buf4" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

           <ImageView 
            android:id="@+id/buf5" 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent" 
            android:background="@drawable/disattivato" 
            android:scaleType="fitXY" /> 

          </LinearLayout> 
        other linear layouts with the same exactly structure 

      </LinearLayout> 
     </HorizontalScrollView> 

+0

我做到了,但仍然没有出现水平滚动...是正确的android设置图像列表:layout_width =“wrap_content”? – Nadir

+0

旁边的线性布局 – Nadir

回答

1

一个基本的轮廓为你的布局如下。请密切关注您在View上设置wrap_contentmatch_parent的位置,因为这是造成问题的原因。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" > 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/tv1" 
      android:layout_width="match_parent" 
      android:layout_height="0dip" 
      android:layout_weight="1" 
      android:background="@drawable/backgroundbutton" 
      android:gravity="center" 
      android:text="kick11" 
      android:textColor="#000000" 
      android:textSize="8pt" 
      android:textStyle="bold" /> 

    </LinearLayout> 

    <HorizontalScrollView 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:fillViewport="true" > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:orientation="vertical" > 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="0dip" 
       android:layout_weight="1" 
       android:orientation="horizontal" > 

       <ImageView 
        android:id="@+id/im11" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:adjustViewBounds="false" 
        android:background="@drawable/disattivato" 
        android:scaleType="fitXY" /> 

       <ImageView 
        android:id="@+id/im12" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/disattivato" 
        android:scaleType="fitXY" /> 

       ... 
       ... 

      </LinearLayout> 

      ... 
      ... 

     </LinearLayout> 

    </HorizontalScrollView> 

</LinearLayout> 
相关问题