1

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

2
  • change height of every textview to wrap_content. Commented Sep 13, 2016 at 10:38
  • according to your picture you attached..you did not change 1st textview height from android:layout_height="match_parent" to android:layout_height="wrap_content" Commented Sep 13, 2016 at 10:43

1 Answer 1

2

Change your all TextViewheight 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"
Sign up to request clarification or add additional context in comments.

9 Comments

Nothing changed. The output still remained the same
What if I add another linear layout and add one textview in that linear layout?
I just put the picture in the post. I do not know how to post a picture in a comment.
@JezreelMartin clean the project and rebuild. may be it will solve your problem.
ok. You will be the one I'll first consult upon proggressing with android apk programming
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.