I researched the attribute value wrap_content on another thread and found its function to be to " force [the view] to expand only far enough to contain the values (or child controls) it contains. For controls -- like text boxes (TextView) or images (ImageView) -- this will wrap the text or image being shown."(What's the difference between fill_parent and wrap_content?) Heres my code(for empty edittext
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Email"
android:padding="5dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
And the resulting layout(selected one is the edit text) https://i.sstatic.net/w0UjK.jpg
My question is that because the edit text contains nothing(empty text), shouldnt wrap_ content force it to have no height?
wrap_content
should be different ,once you make widgets by default wrap_content ,it will adjust the widget size automatically for all the screen such as small,medium and big screens.
But you have mention dp wise, all screen follows dp values only but it will not adjust automatically.
fill_parent
and match_parent
will stretch with their parent layout