Как сделать несколько Expandable Layout в одном Activity
у меня есть Activity в котором есть ExpandableLayout и при добавлении его он не работает. То есть я нажимаю на 1 и он раскрывается и закрывается как и надо а при нажатии на второй ничего не происходит.
Java
import com.example.admin1.bottomtabexample.R;
public class Customs extends BaseCollapseActivity {
@Override
protected int getLayoutResourceId()
{
return R.layout.activity_customs;
}
@Override
protected int getExpandableLayoutId() {
return R.id.layout_expandable;
}
@Override
protected int getButtonId() {
return R.id.button;
}
}
xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.github.chuross.library.ExpandableLayout
android:id="@+id/layout_expandable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="1.5dp"
android:layout_marginLeft="1.5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="1.5dp"
android:layout_marginRight="1.5dp"
app:exl_collapseHeight="50dp">
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/layout_expandable"
android:background="@drawable/block_background_8"
android:gravity="center"
android:padding="5dp"
android:text="@string/Keys"
android:textAllCaps="false"
android:textColor="@color/text_color_2"
android:textSize="25sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="52dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginEnd="1dp"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="@drawable/block_background_6"
android:text="@string/k_s_13"
android:textAllCaps="false"
android:textColor="@color/text_color_1"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="@drawable/block_background_6"
android:text="@string/k_c_1"
android:textAllCaps="false"
android:textColor="@color/text_color_1"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="@drawable/block_background_6"
android:text="@string/k_c_1"
android:textAllCaps="false"
android:textColor="@color/text_color_1"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</com.github.chuross.library.ExpandableLayout>
<com.github.chuross.library.ExpandableLayout
android:id="@+id/layout_expandable_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="1.5dp"
android:layout_marginLeft="1.5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="1.5dp"
android:layout_marginRight="1.5dp"
app:exl_collapseHeight="50dp">
<Button
android:id="@+id/button_2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/layout_expandable"
android:background="@drawable/block_background_8"
android:gravity="center"
android:padding="5dp"
android:text="@string/Keys"
android:textAllCaps="false"
android:textColor="@color/text_color_2"
android:textSize="25sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="52dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginEnd="1dp"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="@drawable/block_background_6"
android:text="@string/k_s_13"
android:textAllCaps="false"
android:textColor="@color/text_color_1"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="@drawable/block_background_6"
android:text="@string/k_c_1"
android:textAllCaps="false"
android:textColor="@color/text_color_1"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="@drawable/block_background_6"
android:text="@string/k_c_1"
android:textAllCaps="false"
android:textColor="@color/text_color_1"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</com.github.chuross.library.ExpandableLayout>
</LinearLayout>
</ScrollView>