我有一个前期非常厚的搜索栏。稍后在drawable我设置高度属性,它很好,但它只适用于SDK 23或更多。
SchedulePickupFragment.xml
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="@+id/imgFragment">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="in.junkart.junkart.SchedulePickupFragment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E4E4E4">
<LinearLayout
tools:context="in.junkart.junkart.SchedulePickupFragment"
android:id="@+id/pickup_linearLayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/layout_bg"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true">
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textAutoComplete|textPersonName"
android:imeOptions="actionNext"
android:hint="Name"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/input_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|phone"
android:imeOptions="actionNext"
android:hint="Phone"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_pickup_time"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/input_pickup_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:hint="Pickup Time"
android:focusable="false"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp"
android:orientation="horizontal">
<TextView
android:layout_width="150sp"
android:layout_height="wrap_content"
android:text="Estimate Weight:"
android:textSize="15sp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/estmtWght"
android:layout_width="70sp"
android:layout_height="wrap_content"
android:text="20 Kg"
android:textSize="15sp"
android:textColor="@color/colorPrimaryDark"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"/>
</LinearLayout>
<SeekBar
android:id="@+id/seekbar"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:max="10"
android:layout_marginTop="10dp"
android:progressDrawable="@drawable/progress"
android:thumb="@drawable/thumb"
>
</SeekBar>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<AutoCompleteTextView
android:id="@+id/input_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Address"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_locality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<AutoCompleteTextView
android:id="@+id/input_locality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Locality"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<AutoCompleteTextView
android:id="@+id/input_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Pin"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress|textAutoComplete"
android:imeOptions="actionDone"
android:hint="Email"
android:textColorHint="@color/colorPrimaryLight"
android:paddingStart="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_message"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/input_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Message (If Any)"
android:textColorHint="@color/colorPrimaryLight"
android:paddingLeft="15dp"
android:paddingStart="15dp"/>
</android.support.design.widget.TextInputLayout>
<ImageButton
android:layout_width="290dp"
android:layout_height="70dp"
android:id="@+id/btn_schedule_pickup"
android:layout_below="@+id/pickup_linearLayout"
android:layout_alignParentBottom="true"
android:src="@drawable/confirm_button_normal"
android:layout_centerHorizontal="true"
android:layout_marginBottom="0dp"
android:scaleType="fitXY"
android:background="@color/white"
android:layout_marginLeft="0dp"
android:layout_marginTop="30dp"
android:layout_marginRight="0dp" />
</LinearLayout>
<!-- Fix user request form (weight, mandatory location - address autofill, state hidden field, locality, pincode)-->
</RelativeLayout>
</ScrollView>
Progress.xml(可绘制)
<item
android:id="@android:id/background"
android:drawable="@drawable/background_fill"
android:height="4dp"
android:layout_height="4dp"
android:top="6dp">
</item>
<item
android:id="@android:id/progress"
android:height="4dp"
android:layout_height="4dp"
android:top="6dp">
<clip android:drawable="@drawable/progress_fill"/>
</item>
progress.xml中的height属性似乎不适用于sdk 22及更低版本。