Ich muss das Layout auf die Art und Weise, dass keine hart codierten Werte in dp, so dass ich versuche Gewicht zu verwenden, um Höhe zu Ansichten.I versuchen UI hat die gleiche aussehen sowohl Handys als auch Tablets.Höhe geben, scrollview ohne Größe in dp
Aber die Bildlaufansicht lässt keine layout_weight zu Ich habe Höhe der Scrollview festgelegt. Ich möchte das nicht tun.
Wie kann ich die Höhe des Scrollview oder dem Haupt eingeschlossen Container Layout in das Gewicht mit/ohne harte Kodierung in dp?
XML
<RelativeLayout 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:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="120dp"//WANT TO AVOID HARD CODING
android:layout_above="@+id/btn_signup"
android:fadeScrollbars="false"
android:scrollbarAlwaysDrawVerticalTrack="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/roomno_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ROOM NO"
android:inputType="number"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="FIRST NAME"
android:inputType="text"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="LAST NAME"
android:inputType="text"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btn_signup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="20dp"
android:background="@color/colorPrimary"
android:text="Checkin"
android:textColor="@android:color/white"/>
</RelativeLayout>
Aber Ihr Code noch hat android: layout_height = "120dp" für Scroll –
ops ich sie zu aktualisieren vergessen, – Max