2012-12-27 93 views
-4

我是新的android開發,我想在這樣的機器人的屏幕:Android的佈局設計

任何一個可以幫助我在做這個:

  1. ImageView的(留下20像素的空間從左,右和頂部)。
  2. 空間。
  3. TextView。
  4. 空間。
  5. TextView1。
  6. 空間。
  7. TextView2:TextView3。
  8. 空間。

。 。 ....

如果imageView不在那裏,textview應該出來,imageview應該隱藏。

+0

線性佈局方向:垂直 –

+0

如何從頂部空間給予和左 – user1902994

+0

您可以使用保證金爲 –

回答

0

例子:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ll" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="5dip" 
     android:layout_marginLeft="20dip" 
     android:layout_marginRight="20dip" 
     android:layout_marginTop="20dip" 
     android:src="@drawable/img"/> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="5dip" 
     android:layout_marginLeft="2dip" 
     android:layout_marginRight="2dip" 
     android:layout_marginTop="5dip" 
     android:text="Txt1"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="5dip" 
     android:layout_marginLeft="2dip" 
     android:layout_marginRight="2dip" 
     android:layout_marginTop="5dip" 
     android:text="Txt2"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="5dip" 
     android:layout_marginLeft="2dip" 
     android:layout_marginRight="2dip" 
     android:layout_marginTop="5dip" 
     android:text="Txt3"/> 

</LinearLayout>