Java 如何在crystal seek bar Android中禁用水平滚动
我使用crystal seekbar进行水平滚动,但我需要禁用滚动…我在禁用模式下的相对布局中有crystal seekbar的相对布局,所以在禁用模式下布局时不希望滚动crystal seekbarJava 如何在crystal seek bar Android中禁用水平滚动,java,android,Java,Android,我使用crystal seekbar进行水平滚动,但我需要禁用滚动…我在禁用模式下的相对布局中有crystal seekbar的相对布局,所以在禁用模式下布局时不希望滚动crystal seekbar <RelativeLayout android:id="@+id/adjust_card_layout" android:layout_width="match_parent" android:layout_height
<RelativeLayout
android:id="@+id/adjust_card_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/adjust_card_disable_background"
android:layout_below="@+id/card_layout"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:paddingBottom="40dp"
android:paddingTop="40dp">
<RelativeLayout
android:id="@+id/adjust_text_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/select_card_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/select_card"
android:layout_centerHorizontal="true"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="visible"/>
<TextView
android:id="@+id/adjust_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adjust values for"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="gone"/>
<TextView
android:id="@+id/shop_visit_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First Shop"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold"
android:layout_toRightOf="@+id/adjust_text"
android:visibility="gone"
android:layout_marginLeft="5dp"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:layout_below="@+id/adjust_text_layout"
android:layout_marginBottom="20dp">
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/adjust_hours_layout"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/adjustHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adjust Hours"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="15sp"
android:paddingBottom="5dp"
android:layout_alignBottom="@+id/adjust_hours"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"/>
<TextView
android:id="@+id/adjust_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:background="#A2B0BE"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_marginRight="20dp"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"/>
</RelativeLayout>
<com.crystal.crystalrangeseekbar.widgets.CrystalSeekbar
android:id="@+id/rangeSeekbar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/adjust_hours_layout"
android:layout_marginTop="30dp"
app:bar_color="@color/hours_back"
app:bar_highlight_color="@color/btn_back"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:left_thumb_color="@color/white"
app:left_thumb_color_pressed="@color/white"
app:corner_radius="05"
app:data_type="_integer"
/>
<TextView
android:id="@+id/textMin1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MIN"
android:layout_below="@id/rangeSeekbar1"
android:layout_marginTop="3dp"
android:layout_alignLeft="@+id/rangeSeekbar1"
android:layout_marginLeft="12dp"
android:textSize="13dp"
android:textColor="@color/white"/>
<TextView
android:id="@+id/textMax1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MAX"
android:layout_below="@id/rangeSeekbar1"
android:layout_marginTop="3dp"
android:textSize="13dp"
android:textColor="@color/white"
android:layout_alignRight="@+id/rangeSeekbar1"
android:layout_marginRight="12dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/adjust_mr_layout"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/adjustMr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adjust Mr"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="15sp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:paddingBottom="5dp"
android:layout_alignBottom="@+id/adjust_mr"/>
<TextView
android:id="@+id/adjust_mr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:background="#A2B0BE"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_marginRight="20dp"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"/>
</RelativeLayout>
<com.crystal.crystalrangeseekbar.widgets.CrystalSeekbar
android:id="@+id/rangeSeekbar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/adjust_mr_layout"
android:layout_marginTop="30dp"
app:bar_color="#A2B0BE"
app:bar_highlight_color="@color/btn_back"
app:left_thumb_color="@color/white"
app:left_thumb_color_pressed="@color/white"
app:corner_radius="05"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:data_type="_integer"
/>
<TextView
android:id="@+id/textMin2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MIN"
android:layout_below="@id/rangeSeekbar2"
android:layout_marginTop="3dp"
android:layout_alignLeft="@+id/rangeSeekbar2"
android:textSize="13dp"
android:textColor="@color/white"
android:layout_marginLeft="12dp"/>
<TextView
android:id="@+id/textMax2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MAX"
android:layout_below="@id/rangeSeekbar2"
android:layout_marginTop="3dp"
android:textSize="13dp"
android:textColor="@color/white"
android:layout_alignRight="@+id/rangeSeekbar2"
android:layout_marginRight="12dp"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
禁用父布局是可以的。但这不会禁用内部子级。要禁用seekbar,必须写入seekbar.setEnabled(false)代码>添加一些代码片段also@Nizam父相对布局已禁用(灰显)。当我单击或滚动crystalseekbar时,它会滚动。我只想同时禁用crystalseekbar。您是否尝试禁用crystalseekbar本身而不是父布局?@Nizam否。我禁用了父布局也可修改crystalseekbar<代码>seekbar.setEnabled(false)代码>