Very new to this. Design view looks fine on the screen emulator, but gets cut off when debugging on my physical phone.
I don't know what else to add.
Here is the activity_main.xml
<TextView
android:scrollbars = "vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/SpinnerPrompt"
android:ellipsize="marquee"
android:id="@+id/textViewMinutes"
android:layout_alignTop="@+id/radMale"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/BtnCap"
android:id="@+id/btnGenerate"
android:layout_below="@+id/spinnerMinutes"
android:layout_centerHorizontal="true" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spinnerMinutes"
android:spinnerMode="dropdown"
android:layout_below="@+id/textViewMinutes"
android:layout_alignLeft="@+id/textViewMinutes"
android:layout_alignStart="@+id/textViewMinutes"
android:layout_toStartOf="@+id/radioGroup"
android:layout_toLeftOf="@+id/radioGroup" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/btnGenerate" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/btnGenerate"
android:layout_toEndOf="@+id/btnGenerate"
android:id="@+id/radioGroup"
android:layout_above="@+id/btnGenerate">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Male"
android:id="@+id/radMale"
android:checked="true"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Female"
android:id="@+id/radFemale"
/>
</RadioGroup>
Here is the strings.xml
<resources>
<string name="app_name">Name</string>
<string name="BtnCap">Generate!</string>
<string name="SpinnerPrompt">Choose Number:</string>
<string name="Male">Male</string>
<string name="Female">Female</string>
This is due to different screen sizes having different resolutions.
please check https://stackoverflow.com/a/35311502/2826147
you can try using weightSum, it will solve your issue,
check this
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="@+id/textViewMinutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:ellipsize="marquee"
android:scrollbars="vertical"
android:text="@string/SpinnerPrompt" />
<Button
android:id="@+id/btnGenerate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/spinnerMinutes"
android:layout_centerHorizontal="true"
android:text="@string/BtnCap" />
<Spinner
android:id="@+id/spinnerMinutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textViewMinutes"
android:layout_alignStart="@+id/textViewMinutes"
android:layout_below="@+id/textViewMinutes"
android:layout_toLeftOf="@+id/radioGroup"
android:layout_toStartOf="@+id/radioGroup"
android:spinnerMode="dropdown" />
<ListView
android:id="@+id/listView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/btnGenerate" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btnGenerate"
android:layout_toEndOf="@+id/btnGenerate"
android:layout_toRightOf="@+id/btnGenerate"
android:weightSum="2" >
<RadioButton
android:id="@+id/radMale"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:checked="true"
android:text="Male" />
<RadioButton
android:id="@+id/radFemale"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Female" />
</RadioGroup >
</RelativeLayout >