Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android:ExpandableListview中的不同分隔符高度大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的应用程序中有一个自定义可扩展,我希望标题高度与标题(5dp)和子标题(1dp)不同.我怎么办?这是我的代码

bus_info.xml

<LinearLayout xmlns:android="http://scheR_111_11845@as.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ExpandableListView
    android:id="@+id/expandableBus"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="3dp"
    android:divider="@drawable/expandable_borde_padre"
    android:childDivider="@drawable/expandable_borde_hijo"
    android:groupInDicator="@drawable/expandable"
    android:scrollbars="none"/>

</LinearLayout>

expandable.xml

<SELEctor xmlns:android="http://scheR_111_11845@as.android.com/apk/res/android">
      <item android:drawable="@drawable/expandable_abajo" android:state_empty="true"/>
      <item android:drawable="@drawable/expandable_arriba" android:state_expanded="true"/>
      <item android:drawable="@drawable/expandable_abajo" />
</SELEctor>

expandable_borde_padre.xml

<shape xmlns:android="http://scheR_111_11845@as.android.com/apk/res/android" 
      android:shape="rectangle">
     <solid android:color="@color/negro"/>
     <size android:height="1dp"/>
</shape>

expandable_borde_hijo.xml

<shape xmlns:android="http://scheR_111_11845@as.android.com/apk/res/android" 
    android:shape="rectangle">
    <solid android:color="@color/blanco"/>
    <size android:height="1dp"/>
</shape>

如果我在expandable_borde_padre中更改为5dp也会更改子项

expandable_hijo.java

<LinearLayout xmlns:android="http://scheR_111_11845@as.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="55dip"
android:orientation="vertical" 
android:BACkground="#000000">

<TextView
    android:id="@+id/lblListItem"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="14sp"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:textColor="#FFFFFF"/>

</LinearLayout>

expandable_padre.java

<LinearLayout xmlns:android="http://scheR_111_11845@as.android.com/apk/res/android"
android:id="@+id/fondoExpandablePadre"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp" 
android:BACkground="#000000">


<TextView
    android:id="@+id/lblListHeader"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="1dp"
    android:textSize="15sp"
    android:textColor="#000000" />

</LinearLayout>

解决方法

将divider和childdivider都设置为null.
使用自定义分隔符的自定义标题和子视图.

例如:

对于标题

< TextView>

< /TextView>

< View android:height:"5dp">
< /View>

对于孩子:

< TextView>

< /TextView>

< View android:height:"1dp">
< /View>

大佬总结

以上是大佬教程为你收集整理的Android:ExpandableListview中的不同分隔符高度全部内容,希望文章能够帮你解决Android:ExpandableListview中的不同分隔符高度所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。