Tôi đã tạo một hình chữ nhật để sử dụng nó làm nền danh sách mục. Vấn đề của tôi là đột quỵ không theo đường viền của khung nhìn nhưng hãy để lề của +/- chiều rộng nét.Android: đột quỵ trong một hình dạng tạo ra một lề của chiều rộng đột quỵ
Đây là xml hình dạng của tôi:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadiusRatio="1"
android:shape="rectangle" >
<solid android:color="@color/deminoir" />
<stroke
android:width="4dp"
android:color="@color/deminoir" />
<padding
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp" />
</shape>
Và đây là xml của phong cách của tôi:
<style name="champ">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">vertical</item>
<item name="android:background">@drawable/bordurechamp</item>
</style>
và cuối cùng xml của xem danh sách mục của tôi:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/champ" >
<!-- titre -->
<TextView
android:id="@+id/titre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/deminoir"
android:padding="5dip"
android:text="titre"
android:textAppearance="@android:style/TextAppearance.Large" />
<!-- Contenu -->
<TextView
android:id="@+id/valeur"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="5dip"
android:text="valeur"
android:textAppearance="@android:style/TextAppearance.Medium"
/>
</LinearLayout>
bạn có thể dán mã mẫu không? – developer82
Chỉ sử dụng màu đồng nhất, chỉ sử dụng 6 (và không 8) chữ số để xác định màu của bạn. – Anthony