2016-08-12 15 views
5

Hi tôi muốn làm điều này: enter image description hereLàm thế nào để loại bỏ biên giới trên bố trí

Và giải pháp của tôi

bộ này góc cho LinearLayout: drawable/draw_arc_corner_shape

<shape 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle" > 

<solid 
    android:color="@color/bg_trip_tab_view" > 
</solid> 

<!--<stroke--> 
    <!--android:width="0dp"--> 
    <!--android:color="@color/bg_trip_tab_view" >--> 
<!--</stroke>--> 

<padding 
    android:left="0dp" 
    android:top="5dp" 
    android:right="0dp" 
    android:bottom="5dp" > 
</padding> 

<corners 
    android:radius="11dp" > 
</corners> 

Vòng kết nối phần này: drawable/draw_circle_shape

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval" 
    android:useLevel="false" > 
    <solid android:color="@color/bg_my_trip_tab_view" /> 
    <size 
     android:height="10dp" 
     android:width="10dp" /> 
</shape> 

này dòng gạch ngang bốc thăm: drawable/draw_dash_line_shape

<?xml version="1.0" encoding="utf-8"?> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="line" > 
    <stroke 
     android:dashGap="3dp" 
     android:dashWidth="2dp" 
     android:width="1dp" 
     android:color="@color/bg_my_trip_tab_view" /> 
</shape> 

và đây tạo view (separator) với đường tròn (hình bán nguyệt) trên đầu và cuối và đường gạch ngang giữa : bố cục/dấu tách

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal" 
android:gravity="center_vertical" 
android:layout_alignParentBottom="true"> 

<View 
    android:layout_width="20dp" 
    android:layout_height="20dp" 
    android:layout_marginLeft="-10dp" 
    android:background="@drawable/draw_circle_shape" 
    /> 

<View 
    android:layout_width="0dp" 
    android:layout_height="5dp" 
    android:background="@drawable/draw_dash_line_shape" 
    android:layerType="software" 
    android:layout_weight="1" 
    android:paddingRight="15dp" 
    /> 

<View 
    android:layout_width="20dp" 
    android:layout_height="20dp" 
    android:layout_marginRight="-10dp" 
    android:background="@drawable/draw_circle_shape" 
    /> 
</LinearLayout> 

và ở đây tôi sử dụng nó: bố trí/main_screen

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="@color/bg_my_trip_tab_view" 
> 
<LinearLayout 
    android:id="@+id/linearLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:layout_marginTop="10dp" 
    android:layout_marginBottom="10dp" 
    android:background="@drawable/draw_arc_corner_shape" 
    > 
    <include 
     android:layout_marginTop="@dimen/grid_20" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     layout="@layout/separator" 

     /> 
</LinearLayout> 

và đây là kết quả của tôi: enter image description here

Và câu hỏi của tôi: Làm thế nào tôi có thể loại bỏ biên giới với bóng? Và làm thế nào tôi có thể làm tốt hơn?

+0

Giải pháp có thể có: Tôi có thể sử dụng hình ảnh 9-path ... nhưng tôi không muốn .. –

+0

cố gắng thêm android: stateListAnimator = "@ null" trong bố cục tuyến tính main_screen – USKMobility

+0

Xin chào, tôi đã thử nghiệm bố cục của bạn và không 't thực sự nhận được bất kỳ bóng tối trong cả hai API 19 và API 24 ... – Shaishav

Trả lời

0

Bạn có nhận được bóng viền trong chế độ xem thiết kế xml của Android Studio hay không. Trên thiết bị thực không có bóng hiển thị.

+0

Bố trí tuyến tính của bạn có một số phụ huynh như xem thẻ? – Ramit

+0

Tôi thử nghiệm nó trên thiết bị thực và có bóng –

+0

u đang sử dụng bất kỳ bố mẹ nào của bố cục tuyến tính như cardview vv. Điều đó có thể có bóng. – Ramit

Các vấn đề liên quan