layout problems in Android Studio

2

I have a small problem with my layout looks like this in Android Studio and how it stays on avd:

XMlcode:

<TextViewandroid:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="@string/Linha1"
    android:id="@+id/textView"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="0dp"
    android:layout_alignParentTop="true"
    android:layout_marginTop="20dp" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/A1"
    android:layout_alignBaseline="@+id/textView"
    android:layout_alignBottom="@+id/textView"
    android:layout_toRightOf="@+id/textView"
    android:layout_toEndOf="@+id/textView" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/B1"
    android:layout_above="@+id/textView2"
    android:layout_toRightOf="@+id/textView4"
    android:layout_toEndOf="@+id/textView4" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/C1"
    android:layout_above="@+id/textView2"
    android:layout_toRightOf="@+id/textView7"
    android:layout_toEndOf="@+id/textView7" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/K1"
    android:accessibilityLiveRegion="polite"
    android:layout_above="@+id/textView2"
    android:layout_toRightOf="@+id/textView10"
    android:layout_toEndOf="@+id/textView10" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="@string/Linha2"
    android:id="@+id/textView2"
    android:layout_marginTop="41dp"
    android:layout_below="@+id/A1"
    android:layout_toLeftOf="@+id/A1"
    android:layout_toStartOf="@+id/A1" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/A2"
    android:layout_alignBaseline="@+id/textView2"
    android:layout_alignBottom="@+id/textView2"
    android:layout_toRightOf="@+id/textView2"
    android:layout_toEndOf="@+id/textView2" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/B2"
    android:accessibilityLiveRegion="polite"
    android:layout_alignTop="@+id/A2"
    android:layout_toRightOf="@+id/textView5"
    android:layout_toEndOf="@+id/textView5" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/C2"
    android:layout_above="@+id/textView3"
    android:layout_toRightOf="@+id/textView8"
    android:layout_toEndOf="@+id/textView8" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/K2"
    android:layout_alignTop="@+id/A2"
    android:layout_alignLeft="@+id/K1"
    android:layout_alignStart="@+id/K1" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="@string/Linha3"
    android:id="@+id/textView3"
    android:layout_marginTop="37dp"
    android:layout_below="@+id/A2"
    android:layout_toLeftOf="@+id/A1"
    android:layout_toStartOf="@+id/A1" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/A3"
    android:layout_alignBaseline="@+id/textView3"
    android:layout_alignBottom="@+id/textView3"
    android:layout_toRightOf="@+id/textView3"
    android:layout_toEndOf="@+id/textView3" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/B3"
    android:layout_alignTop="@+id/A3"
    android:layout_alignLeft="@+id/B2"
    android:layout_alignStart="@+id/B2" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/C3"
    android:layout_alignTop="@+id/B3"
    android:layout_toRightOf="@+id/textView9"
    android:layout_toEndOf="@+id/textView9" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/K3"
    android:layout_alignBottom="@+id/C3"
    android:layout_alignLeft="@+id/K2"
    android:layout_alignStart="@+id/K2" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Calcular"
    android:id="@+id/button"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:singleLine="false"
    android:textColor="#54b2c7" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Limpar"
    android:id="@+id/Limpar"
    android:layout_below="@+id/button"
    android:layout_centerHorizontal="true"
    android:onClick="LimparCampos" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/x1"
    android:id="@+id/textView4"
    android:layout_alignTop="@+id/textView"
    android:layout_toRightOf="@+id/A1"
    android:layout_toEndOf="@+id/A1" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/x2"
    android:id="@+id/textView5"
    android:layout_alignTop="@+id/textView2"
    android:layout_toRightOf="@+id/A2"
    android:layout_toEndOf="@+id/A2" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/x3"
    android:id="@+id/textView6"
    android:layout_alignTop="@+id/textView3"
    android:layout_toRightOf="@+id/A3"
    android:layout_toEndOf="@+id/A3" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/y1"
    android:id="@+id/textView7"
    android:layout_alignTop="@+id/textView4"
    android:layout_toRightOf="@+id/B1"
    android:layout_toEndOf="@+id/B1" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/y2"
    android:id="@+id/textView8"
    android:layout_alignTop="@+id/textView5"
    android:layout_toRightOf="@+id/B2"
    android:layout_toEndOf="@+id/B2" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/y3"
    android:id="@+id/textView9"
    android:layout_alignTop="@+id/textView6"
    android:layout_toRightOf="@+id/B3"
    android:layout_toEndOf="@+id/B3" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/z1"
    android:id="@+id/textView10"
    android:layout_alignBottom="@+id/textView7"
    android:layout_toRightOf="@+id/C1"
    android:layout_toEndOf="@+id/C1" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/z2"
    android:id="@+id/textView11"
    android:layout_alignTop="@+id/textView8"
    android:layout_toLeftOf="@+id/K2"
    android:layout_toStartOf="@+id/K2" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/z3"
    android:id="@+id/textView12"
    android:layout_alignTop="@+id/textView9"
    android:layout_toRightOf="@+id/C3"
    android:layout_toEndOf="@+id/C3" />

I would also like to know how and what I do for when I click on enter it go to editText on the side and not to the one that is down and when it arrives on the last one it goes back to the first one down.

/ p>     

asked by anonymous 27.11.2015 / 00:25

2 answers

2

Try adding nextFocusDown to each EditText

  

android: nextFocusDown="@ + id /...">

For example

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/A1"
    android:nextFocusDown="@+id/B1"
    android:layout_alignBaseline="@+id/textView"
    android:layout_alignBottom="@+id/textView"
    android:layout_toRightOf="@+id/textView"
    android:layout_toEndOf="@+id/textView" />

<EditText
    android:layout_width="46dp"
    android:layout_height="wrap_content"
    android:inputType="number|numberSigned|numberDecimal"
    android:ems="10"
    android:id="@+id/B1"
    android:layout_above="@+id/textView2"
    android:layout_toRightOf="@+id/textView4"
    android:layout_toEndOf="@+id/textView4" />

In this way, when you click Enter in EditText A1, EditText B1 gains focus. I hope I have helped.

    
27.11.2015 / 20:20
1

In the xml within the tag of this activity set your screenOrientation for portrait, example:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".activity.HomeActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        **android:screenOrientation="portrait"**
        >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    
27.11.2015 / 15:06