Tôi gặp khó khăn khi phát triển tiện ích 4x1 cho Android.Cách tạo tiện ích kích thước 4x1 trên màn hình chính của Android?
Đây là appprovider
<?xml version="1.0" encoding="utf-8"?> <appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="294dp"
android:minHeight="72dp"
android:initialLayout="@layout/main" />
Và đây là main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320dp"
android:layout_height="100dp"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
//content goes here
</LinearLayout>
tôi có thể thấy tiện ích nhưng kích thước là 4x2. Tôi nhầm lẫn lý do tại sao tôi không thể có kích thước tiện ích 4x1?
Cảm ơn
Không có ai trong số này? – rxlky
Bạn đã thử đặt chiều cao của LinearLayout thành một giá trị nhỏ hơn * (hoặc thậm chí tốt hơn, thành 'fill_parent') *? Kích thước lớn hơn "kích thước tế bào trường hợp xấu nhất" 72dp của bạn, vì vậy có thể trình khởi chạy nói nội bộ "điều này không vừa với một ô, hãy sử dụng hai ô". –
Có, tôi đã thử fill_parent. Vẫn tiện ích vẫn còn 4x2 ... – rxlky