无法在Android中使用View显示垂直线?

时间:2014-08-05 18:11:05

标签: android xml draw shape

有人可以指导我应该在代码中添加什么来绘制固定高度的垂直线我希望垂直线像这个网址中的比例测量see vertical line example 这是我的代码TRIED CODE

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    >
<LinearLayout 
   android:id="@+id/linear_layout_one"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="horizontal"
   android:layout_marginLeft="5dp">


       <View
android:layout_width="5dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/darker_gray"/>
   <View
android:layout_width="5dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>
   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/darker_gray"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>

   <View
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:rotation="90"
android:background="@android:color/holo_purple"/>


</LinearLayout>
</ScrollView>

1 个答案:

答案 0 :(得分:0)

您可以使用drawable资源应用不同的样式 看到类似Add shadow to custom shape on Android

的内容