线性布局分隔器deos不会使用全息显示



>我有这个xml文件,它应该在TextViewButton之间显示divider

我正在使用holoeverywhere库。

使用此代码,除法不显示

    <org.holoeverywhere.widget.LinearLayout
                         xmlns:holo="http://schemas.android.com/apk/res-auto"
                         xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/topcontainer"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        holo:divider="?attr/dividerVertical"
                        holo:dividerPadding="8dp"
                        android:orientation="horizontal"
                        holo:showDividers="middle" >
                        <org.holoeverywhere.widget.TextView
                            android:id="@+id/textView6"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_weight="1"
                            android:text="@string/str1" />
      <org.holoeverywhere.widget.Button
                            android:id="@+id/add"
                            style="?attr/borderlessButtonStyle"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:text="ADD" />
</org.holoeverywhere.widget.LinearLayout>

现在问题出在LinearLayout中的这些属性

holo:divider="?attr/dividerVertical"
holo:dividerPadding="8dp"
holo:showDividers="middle"

如果我将这些属性的namespace更改为这样的android,它可以工作并显示分隔符。

任何建议

使用 android 命名空间。那应该很好。

正如我在这里看到attrs的源代码。

<declare-styleable name="LinearLayout">
        <attr name="android:baselineAligned"/>
        <attr name="android:baselineAlignedChildIndex"/>
        <attr name="android:divider"/>
        <attr name="android:dividerPadding"/>
        <attr name="android:gravity"/>
        <attr name="android:measureWithLargestChild"/>
        <attr name="android:orientation"/>
        <attr name="android:showDividers"/>
        <attr name="android:weightSum"/>
</declare-styleable>

自定义属性似乎是用安卓命名空间定义的。

另外,查看此处org.holoeverywhere.widget.LinearLayout的来源,您会发现LinearLayout类正在使用上述定义的attrs,例如LinearLayout_android_baselineAlignedChildIndex,因此可以使用android namespace

最新更新