1
I’m wearing a TableLayout
that contain EditText
, and when the focus is on EditText
the keyboard opens and stands in front of important information, would like to be able to squeeze the layout when opening the keyboard. For my entire layout (which previously occupied the entire screen) stay whole visible with the keyboard open. This is possible?
Can someone give me some tips or show me a literature/tutorial?
<LinearLayout 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:background="#000000"
android:orientation="vertical"
tools:context="com.example.app.MainActivity" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="4" >
<TableRow
android:layout_width="match_parent"
android:layout_height="40dp"
android:weightSum="1" >
<EditText
android:id="@+id/etdescricao"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000" >
<EditText
android:id="@+id/etl5"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="5" >
<EditText
android:id="@+id/et1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/etl1"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/etl2"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/etl3"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/etl4"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000" >
<EditText
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="5" >
<EditText
android:id="@+id/et6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et7"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et8"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et9"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et10"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000" >
<EditText
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="5" >
<EditText
android:id="@+id/et11"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et12"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et13"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et14"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
<EditText
android:id="@+id/et15"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffffff"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000" >
<EditText
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000"
android:maxLength="100"
android:maxLines="2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="5" >
<Button
android:id="@+id/btSalvar"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/btn_selector"
android:text="Salvar"
android:textColor="#ffffff"
android:textSize="30sp" />
<Button
android:id="@+id/BtPrevious2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/btn_selector"
android:text="@string/previous"
android:textColor="#ffffff"
android:textSize="30sp" />
<Button
android:id="@+id/tvp2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:singleLine="true"
android:textColor="#ff0000"
android:textSize="75sp" />
<Button
android:id="@+id/btNext2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/btn_selector"
android:text="@string/Next"
android:textColor="#ffffff"
android:textSize="30sp" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:src="@drawable/logostar" />
<!-- android:background="#000000" -->
</TableRow>
</TableLayout>
</LinearLayout>
You want your layout to resize when the keyboard appears?
– Wakim
yes, make it smaller, so that the screen is always visible. I want to decrease the length of the lines so that when it appears the keyboard n adds nothing.
– Joannis
but at the same time I want to leave self-adjusting for different screen sizes... I will post my xml
– Joannis
did not want the buttons to disappear nor the page number and this to edit all edittext without closing the keyboard
– Joannis
Expremer the layout would be a bad result, in cell phones that have the small screen would lose a lot in visual quality , ocerto is encapsulate its layout within a scrollview equal to Cícero Moura replied.
– Skywalker
@Juarez The application is only for tablets, but Valew, I think I’ll do yes.
– Joannis