文本没有出现在CheckBox android

时间:2018-03-14 08:58:43

标签: android xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:card_view_Maint_RecyclerView="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:scrollbars="vertical">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        android:id="@+id/card_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="@dimen/activity_horizontal_margin"
        android:layout_marginBottom="@dimen/activity_horizontal_margin"
        android:layout_marginLeft="@dimen/activity_custom_margin"
        android:layout_marginRight="@dimen/activity_custom_margin"
        android:layout_weight="0.54"
        card_view:cardElevation="@dimen/cardview_default_elevation"
        card_view:contentPadding="10dp">

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">
                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/input_layout_Maint_Fail"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:layout_weight="1">

                        <com.efftronics.android.eEmployee.Common.UI.CustomAutoCompleteTextView
                            android:id="@+id/SpMainFail"
                            android:imeOptions="actionSend|flagNoEnterAction"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:hint="FailureType"
                            android:textColorHint="@color/accent"/>

                    </android.support.design.widget.TextInputLayout>
            </TableRow>
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_Maint_Modules"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1">

                    <com.efftronics.android.eEmployee.Common.UI.CustomAutoCompleteTextView
                        android:id="@+id/SpMaintModules"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:hint="Module"
                        android:imeOptions="actionSend|flagNoEnterAction"
                        android:textColorHint="@color/accent"/>

                </android.support.design.widget.TextInputLayout>

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_Maint_Problems"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1">

                    <com.efftronics.android.eEmployee.Common.UI.CustomAutoCompleteTextView
                        android:id="@+id/SpMaintProblems"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:hint="Problem"
                        android:imeOptions="actionSend|flagNoEnterAction"
                        android:textColorHint="@color/accent" />

                </android.support.design.widget.TextInputLayout>

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_Maint_Symptom"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1">

                    <com.efftronics.android.eEmployee.Common.UI.CustomAutoCompleteTextView
                        android:id="@+id/SpMaintSymptom"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:hint="Symptom"
                        android:imeOptions="actionSend|flagNoEnterAction"
                        android:textColorHint="@color/accent"/>

                </android.support.design.widget.TextInputLayout>

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_Maint_Resolution"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1">

                    <com.efftronics.android.eEmployee.Common.UI.CustomAutoCompleteTextView
                        android:id="@+id/SpMaintResolutions"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:hint="Resolution"
                        android:imeOptions="actionSend|flagNoEnterAction"
                        android:textColorHint="@color/accent"/>

                </android.support.design.widget.TextInputLayout>

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <Spinner
                    android:id="@+id/SpMaintStatus"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"/>

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">
                <CheckBox

                    android:id="@+id/cbProductdown_"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:theme = "@style/CheckBoxTheme"
                    />

                <TextView
                    android:id="@+id/tvPeriodText_"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/Product_Down"
                    android:textColor="@color/black" />
            </TableRow>
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:layout_weight="1">

                <Button
                    android:id="@+id/btn_Maint_ok"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="0.5"
                    android:gravity="center"
                    android:text="@string/OK"
                    android:textColor="@color/white"
                    android:theme="@style/CustomButtonStyle"/>

                <Button
                    android:id="@+id/btn_Maint_cancel"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.5"
                    android:text="@string/Cancel"
                    android:textColor="@color/white"
                    android:theme="@style/CustomButtonStyle"/>
</TableRow>
</TableLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>

This is my dialog The Text <code>product down</code> is moving to end when trying to fill remaining fields. Some times It will disappear

这是复选框主题

<style name="CheckBoxTheme" parent="Theme.AppCompat.Light">
    <item name="colorControlNormal">@color/Lightaccent</item>
    <item name="colorControlActivated">@color/accent</item>
</style>

文字product down正在结束。在开始时它将处于正确的位置,但是当从头开始填充字段时,自动文本视图将移动到右侧。我在这里使用相对布局。

我添加了完整的布局代码。有时它会消失。

可能是什么问题?请帮我。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

这可能是因为您的主题var clientSocket = net.createConnection(33333, "127.0.0.1"); clientSocket.on('data', (someData) => { console.log('Data received', someData); }); clientSocket.on('connect', () => { console.log('Client Socket connected '); clientSocket.write('Hello from client'); });

  • 删除主题可能会解决您的问题。
  • @style/CheckBoxTheme小部件添加到android:text小部件中,如下所示: -

    CheckBox

    相反 CheckBox 旁添加 TextView小工具,您可以直接文本分配到您的复选框({{ 1}})