Reputation: 89
My TextView
is not displaying in the Screen.
This app shows information from your SIM card and gets your MAC address. If you have 2 SIM cards inserted, information from SIM card in slot 1 will be retrieved.
Mobile Country Code
Mobile Network Code
Radio Type
Mac Address
Cell Id
Location Area code
The code I used in the mainactivity.xml is:
<?xml version="1.0" encoding="utf-8"?>
<!--suppress ALL -->
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.example.onlyus.test1.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/intro" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/mcc_code" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/mnc_code" />
However it just outputs the text from the first textview. I have defined mcc_code
and mnc_code
in strings.xml But it does not output the string. I just started coding apk file. Any help would be greatly appreciated
Upvotes: 1
Views: 896
Reputation: 20910
Change your all TextView
height match_parent
to wrap_content
it will solve your Problem.
So Change this
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/intro" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/mcc_code" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/mnc_code" />
to this
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/intro" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mcc_code" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mnc_code" />
For Put Space
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mcc_code"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mnc_code"
android:layout_marginTop="10dp" />
For Font Size :
Add this property
android:textSize="16sp"
Upvotes: 2