我需要禁用开关兼容性中的滑动,我使用OnclickListener来切换开关。我已经实现了onClickListener的一些功能,但是当用户滑动切换器时,他并没有实现功能。我需要禁用开关兼容性的滑动。
注意:由于onCheckedListener出现一些问题,因此我没有使用onCheckedlistener。
Run Code Online (Sandbox Code Playgroud)<android.support.v7.widget.SwitchCompat android:id="@+id/switchButton" android:layout_width="wrap_content" android:layout_centerInParent="true" android:checked="false" android:scrollbarAlwaysDrawVerticalTrack="true" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="Switch example" />
Run Code Online (Sandbox Code Playgroud)SwitchCompat switchCompat; switchCompat=(SwitchCompat)findViewById(R.id.switchButton); switchCompat.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(getApplicationContext(), "toggled", Toast.LENGTH_SHORT).show(); //added } });
我正在使用底部导航视图并显示三个选项卡,在其中一个选项卡中我添加了回收站视图,但内容与底部导航重叠。无法滚动回收站视图。有什么方法可以隐藏底部导航我在回收站视图上滚动项目。
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:sv="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".activity.patient.PatientsActivity">
<include
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="@+id/asd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="60dp"
android:orientation="vertical">
<co.moonmonkeylabs.realmrecyclerview.RealmRecyclerView
android:id="@+id/appointmentsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:rrvEmptyLayoutId="@layout/empty_view"
app:rrvLayoutType="LinearLayout"
app:rrvSwipeToDelete="true" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/white"
app:layout_behavior=".BottomNavigationBehavior"
app:menu="@menu/bottom_navigation_main" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout> </android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
我有字符串值
String valueData = "{\"x\":10,\"y\":10,\"z\":10}"
Run Code Online (Sandbox Code Playgroud)
如何格式化为 x:10,y:10,z:10
请帮我正则表达