2012-03-13 91 views
0

如何在android中使用相對佈局設計下面的圖像。我沒有設計,但它不像圖像,我不知道如何繪製垂直和水平分隔符。它不過是android通話記錄屏幕。如何設置android中的圖像

enter image description here

回答

1

下面的代碼給出了這樣的結果:
screenshot
可以使用一些調整,但基本是有。

  • 隔板是View對象具有寬度(或高度,這取決於 上取向)的1像素。
  • 小綠箭頭(這裏用 表示一個正方形)是Compound Drawable屬於TextView顯示 號碼。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <TextView 
     android:id="@+id/number" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/smallsquare" 
     android:drawablePadding="8dp" 
     android:text="1-234-567-890" 
     android:textColor="#FFFF" 
     android:textSize="20sp" 
     android:textStyle="bold"/> 
    <TextView 
     android:id="@+id/time" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="3dp" 
     android:layout_toLeftOf="@+id/separator_vert" 
     android:text="13 mins ago" 
     android:layout_below="@+id/number"/> 
    <View 
     android:id="@+id/separator_vert" 
     android:layout_width="1px" 
     android:layout_height="0dp" 
     android:layout_margin="2dp" 
     android:layout_alignParentTop="true" 
     android:layout_toLeftOf="@+id/phoneicon" 
     android:layout_above="@+id/separator_horz" 
     android:background="#FFAAAAAA"/> 
    <View 
     android:id="@+id/separator_horz" 
     android:layout_width="0dp" 
     android:layout_height="1px"  android:layout_margin="2dp" 
     android:layout_below="@+id/time" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:background="#FFAAAAAA"/> 
    <ImageView 
     android:id="@+id/phoneicon" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_margin="5dp" 
     android:src="@drawable/mediumsquare"/> </RelativeLayout> 
+0

由於這是我想設計。謝謝 – 2012-03-13 13:01:48

相關問題