簡體   English   中英

Android:Imageview之間的間距

[英]Android: Spacing between Imageviews

嗨,我有4個圖像並排,我正在嘗試增加imageviews之間的間距...但是itz無法正常工作..嘗試了java中的setSpacing(int)... android:spacing in xml layout

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"
    android:orientation="horizontal" >
    <ImageView
        android:id="@+id/navigationImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="left"
        android:paddingLeft="15dp"
        android:spacing="15dp" />
    <ImageView
        android:id="@+id/streetViewImage"
        android:src="@drawable/streetview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="left"
        android:paddingLeft="15dp"
        android:spacing="15dp" />
    <ImageView
        android:id="@+id/phoneImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="left"
        android:paddingLeft="20dp"
        android:paddingRight="15dp"
        android:spacing="15dp" />
</LinearLayout>

這是我的Java代碼

 ImageView Image = (ImageView) view.findViewById(R.id.navImage);
 Image.setImageResource(R.drawable.navigation);
 Image.setSpacing(5);

任何幫助表示贊賞

您應該了解paddingmargin的區別:

SO上的填充和邊距之間的差異

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM