【发布时间】:2016-06-06 10:13:15
【问题描述】:
我的 linearLayout (weightSum=10) 中有 5 个图像视图(layout_weight=2 每个) 所有的图像视图都有 0dp 宽度和 wrap_content 高度,但我总是有一个顶部和底部边距...... 当我使用设计视图时,如果我尝试手动调整我的线性布局高度(通过扩展边框),最后一个被设置为固定值,这不是我想要的原因(不再动态)
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/fond">
<TextView/>
<LinearLayout>
<ImageView/>
<TextView/>
<TextView/>
<ImageView/>
</LinearLayout>
<TextView
android:text="ECRANS DISPONIBLES"
android:drawableLeft="@drawable/selectsite_picto_search"
android:drawablePadding="2dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textStyle="normal"
android:layout_margin="10dp"
android:id="@+id/homeScreenAvailableTextView"
android:textColor="#FFF" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#26FFFFFF"
android:weightSum="10">
<ImageView
android:id="@+id/item_home_screen1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/home_poster1"
android:layout_weight="2"/>
<ImageView
android:id="@+id/item_home_screen2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/home_poster2"
android:layout_weight="2"/>
<ImageView
android:id="@+id/item_home_screen3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/home_poster3"
android:layout_weight="2"/>
<ImageView
android:id="@+id/item_home_screen4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/home_poster4"
android:layout_weight="2"/>
<ImageView
android:id="@+id/item_home_screen5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/home_poster5"
android:layout_weight="2"/>
</LinearLayout>
<TextView/>
<TextView/>
<TextView/>
<TextView/>
</LinearLayout>
</ScrollView>
【问题讨论】:
-
看我的回答@gamerounet..!!
标签: android imageview android-linearlayout android-layout-weight