Tôi đang cố gắng sử dụng appcompat mới nhất đã được cập nhật cho thiết kế material design trong ứng dụng của tôi để hiển thị chế độ xem chuyển đổi như được hiển thị trong Lollipop (http://android-developers.blogspot.in/2014/10/appcompat-v21-material-design-for-pre.html), vấn đề là công tắc không được hiển thị. SDKmin của tôi là 14 và tối đa là 21. Tôi đang sử dụng mã dưới đây vào cách bố trí:Switchcompat không hiển thị Switch
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/fragment_scheduler"
tools:context="com.stackoverflow.ranjith.androidprojdel.SchedulerUI">
<android.support.v7.widget.SwitchCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="switch"
app:showText="false" />
<Button
android:layout_width="match_parent"
android:text="start"
android:id="@+id/start"
android:layout_height="wrap_content" />
</LinearLayout>
Build.gradle:
dependencies {
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:support-v4:+'
compile "com.android.support:appcompat-v7:21.0.+"
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Đây có phải là toàn bộ bố trí? Cái gì là SwitchCompat đang được thêm vào? – ianhanniballake
Không..khác cũng là nút trong bố cục. Nó nằm trong linearlayout. Tôi đã thêm toàn bộ bố cục – Psypher
Bất kỳ chế độ xem nào về cách làm việc này? – Psypher