转换为卡片视图

时间:2018-04-06 11:58:41

标签: android android-layout android-cardview

任何人都可以帮助将我的xml布局转换为卡片视图。我正在设置一个xml页面来显示客户详细信息并编辑金额和付款方式的值我希望textview of amount和payment mode可以编辑。转换为卡片视图时,我无法编辑金额和付款方式的值

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/coordinatorlayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <include layout="@layout/base_toolbar" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:padding="20dp">


           <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/customer_info_edit_text_border"
                android:orientation="horizontal"
                android:layout_marginTop="18dp"
                android:gravity="center_vertical">

                < <TextView
                    android:id="@+id/mobile_number"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:maxLines="1"
                    android:textColorHint="@color/gray_1"
                    android:padding="6dp"
                    android:background="@null"
                    android:inputType="phone"
                    android:drawableLeft="@drawable/ic_phone_white_24dp"
                    android:drawableTint="@color/gray_1"
                    android:drawablePadding="8dp"
                    android:hint="Mobile number"/>

                <ProgressBar
                    android:visibility="invisible"
                    android:layout_height="30dp"
                    android:layout_width="30dp"
                    android:id="@+id/ctrlActivityIndicator"
                    android:indeterminateOnly="true"
                    android:keepScreenOn="true"
                    />

            </LinearLayout>



            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/customer_info_edit_text_border"
                android:orientation="horizontal"
                android:layout_marginTop="18dp"
                android:gravity="center_vertical">

                < <TextView
                    android:id="@+id/first_name"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:maxLines="1"
                    android:textColorHint="@color/gray_1"
                    android:padding="6dp"
                    android:background="@null"
                    android:inputType="textPersonName|textCapWords"
                    android:drawableLeft="@drawable/ic_person_black_24dp"
                    android:drawableTint="@color/gray_1"
                    android:drawablePadding="8dp"
                    android:saveEnabled="false"
                    android:hint="First name"/>
            </LinearLayout>





               <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/customer_info_edit_text_border"
                  android:orientation="horizontal"
                  android:layout_marginTop="18dp"
                  android:gravity="center_vertical">



                  < <TextView
                      android:id="@+id/amount"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:maxLines="1"
                      android:textColorHint="@color/gray_1"
                      android:padding="6dp"
                      android:singleLine="true"
                      android:background="@null"
                      android:inputType= "numberDecimal|numberSigned"
                      android:drawableTint="@color/gray_1"
                      android:drawablePadding="8dp"
                      android:drawableLeft="@drawable/ic_payment_black_24dp"
                      android:hint="Amount" />

              </LinearLayout>
                  <RadioGroup
                      android:id="@+id/payment_mode"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_margin="10dp"
                      android:orientation="horizontal">

                      <RadioButton
                          style="@style/LinkButton"
                          android:id="@+id/cash"
                          android:text="CASH" />
                      <RadioButton
                          style="@style/LinkButton"
                          android:id="@+id/card"
                          android:text="CARD" />



            <com.devspark.robototextview.widget.RobotoButton
                android:id="@+id/submit_customer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:textColor="@color/white"
                app:typeface="roboto_bold"
                android:text="Submit"
                android:background="@color/android_orange"/>

        </LinearLayout>

    </ScrollView>
 </LinearLayout>

1 个答案:

答案 0 :(得分:0)

试试这个。

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/coordinatorlayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <include layout="@layout/base_toolbar" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white">

<android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:padding="20dp">


           <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/customer_info_edit_text_border"
                android:orientation="horizontal"
                android:layout_marginTop="18dp"
                android:gravity="center_vertical">

                <EditText
                    android:id="@+id/mobile_number"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:maxLines="1"
                    android:textColorHint="@color/gray_1"
                    android:padding="6dp"
                    android:background="@null"
                    android:inputType="phone"
                    android:drawableLeft="@drawable/ic_phone_white_24dp"
                    android:drawableTint="@color/gray_1"
                    android:drawablePadding="8dp"
                    android:hint="Mobile number"/>

                <ProgressBar
                    android:visibility="invisible"
                    android:layout_height="30dp"
                    android:layout_width="30dp"
                    android:id="@+id/ctrlActivityIndicator"
                    android:indeterminateOnly="true"
                    android:keepScreenOn="true"/>

            </LinearLayout>

              <EditText
                    android:id="@+id/first_name"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:maxLines="1"
                    android:textColorHint="@color/gray_1"
                    android:padding="6dp"
                    android:background="@drawable/customer_info_edit_text_border"
                    android:inputType="textPersonName|textCapWords"
                    android:drawableLeft="@drawable/ic_person_black_24dp"
                    android:drawableTint="@color/gray_1"
                    android:drawablePadding="8dp"
                    android:saveEnabled="false"
                    android:layout_marginTop="18dp"
                    android:gravity="center_vertical"
                    android:hint="First name"/>

               <EditText
                      android:id="@+id/amount"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:maxLines="1"
                      android:textColorHint="@color/gray_1"
                      android:padding="6dp"
                      android:singleLine="true"
                      android:inputType= "numberDecimal|numberSigned"
                      android:drawableTint="@color/gray_1"
                      android:drawablePadding="8dp"
                      android:drawableLeft="@drawable/ic_payment_black_24dp"
                      android:layout_marginTop="18dp"
                      android:gravity="center_vertical"
                      android:background="@drawable/customer_info_edit_text_border"
                      android:hint="Amount" />

                  <RadioGroup
                      android:id="@+id/payment_mode"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_margin="10dp"
                      android:orientation="horizontal">

                      <RadioButton
                          style="@style/LinkButton"
                          android:id="@+id/cash"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="CASH" />
                      <RadioButton
                          style="@style/LinkButton"
                          android:id="@+id/card"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="CARD" />
                  </RadioGroup>    


            <com.devspark.robototextview.widget.RobotoButton
                android:id="@+id/submit_customer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:textColor="@color/white"
                app:typeface="roboto_bold"
                android:text="Submit"
                android:background="@color/android_orange"/>

        </LinearLayout>
      </android.support.v7.widget.CardView>

    </ScrollView>
 </LinearLayout>