0
thisライブラリを使用して、アンドロイドでDouble RangeBarを作成しています。このレンジバーでは、左のピンが右のピンと重なると、それは前の位置に戻る必要があります。これはflipkartで価格レンジをフィルタリングするのと同じです(Flipkartはこのようにレンジバーを使用します)。私は同じようなプロパティを実装したい。どのように私はこのプロパティを実装することができます。助けてください。 ありがとうございます。 これは私がこのライブラリを使用していますが、試すことができますどのような彼らのコードを見ることはありませんしている私の活動とxmlcom.appyvet.rangebar.RangeBarのピンをオーバーラップさせない
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.range_bar);
min = (TextView)findViewById(R.id.min);
sign_rupees = (TextView)findViewById(R.id.sign_rupees);
sign_rupees2 = (TextView)findViewById(R.id.sign_rupees2);
selected_min = (TextView)findViewById(R.id.selected_min);
selected_max = (TextView)findViewById(R.id.selected_max);
rangeBar = (RangeBar)findViewById(R.id.rangebar3);
rangeBar.setOnRangeBarChangeListener(this);
}
@Override
public void onRangeChangeListener(RangeBar rangeBar, int leftPinIndex, int rightPinIndex, String leftPinValue, String rightPinValue) {
int diff = rightPinIndex-leftPinIndex;
if (diff == 0){
rangeBar.setRangePinsByIndices(leftPinIndex-1,rightPinIndex+1);
rangeBar.setEnabled(true);
}else{
rangeBar.setEnabled(true);
if (leftPinIndex == 0){
min.setText("Min");
min.setVisibility(View.VISIBLE);
sign_rupees.setVisibility(View.INVISIBLE);
selected_min.setVisibility(View.INVISIBLE);
}else{
min.setVisibility(View.GONE);
sign_rupees.setVisibility(View.VISIBLE);
selected_min.setVisibility(View.VISIBLE);
selected_min.setText(String.valueOf(leftPinIndex*500));
}
if (rightPinIndex == 6){
selected_max.setText("2500+");
}else{
selected_max.setText(String.valueOf(rightPinIndex*500));
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rangebar1"
android:layout_marginBottom="10dp">
<com.appyvet.rangebar.RangeBar
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/rangebar3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
custom:tickStart="0"
custom:tickInterval="1"
custom:tickEnd="6"
custom:pinRadius="20dp"
custom:pinMinFont="5sp"
custom:textColor="@android:color/transparent"
custom:selectorSize="5dp"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/left_linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rangebar1">
<TextView
android:id="@+id/min_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Min Price"
android:textSize="12sp"
android:textColor="@color/grey_dark"
android:layout_margin="10dp"/>
<TextView
android:id="@+id/min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Min"
android:textColor="#000"
android:layout_marginLeft="10dp"
android:layout_below="@+id/min_price"
android:visibility="visible"
android:textSize="20sp"/>
<TextView
android:id="@+id/sign_rupees"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rupees_symbol"
android:textColor="#000"
android:layout_marginLeft="10dp"
android:layout_below="@+id/min_price"
android:visibility="invisible"
android:textSize="20sp"/>
<TextView
android:id="@+id/selected_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="250"
android:textColor="#000"
android:layout_marginLeft="5dp"
android:layout_below="@+id/min_price"
android:layout_toRightOf="@+id/sign_rupees"
android:visibility="invisible"
android:textSize="20sp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/right_linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/rangebar1">
<TextView
android:id="@+id/max_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Max Price"
android:textColor="@color/grey_dark"
android:textSize="12sp"
android:layout_alignRight="@+id/rl"/>
<RelativeLayout
android:id="@+id/rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/max_price"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/sign_rupees2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rupees_symbol"
android:textColor="#000"
android:textSize="20sp"/>
<TextView
android:id="@+id/selected_max"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2500+"
android:textColor="#000"
android:textSize="20sp"
android:layout_marginLeft="10dp"/>
</RelativeLayout>
</RelativeLayout>
私はすでにこれを試してみましたが、その正しく動作しません。 – harshita