Android Textview settext issue in Samsung J5 - java

I have a "problem" with my application and I don't know what has happened.
I have this interface:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#color/white"
android:gravity="center"
android:textColor="#color/black" />
<TextView
android:id="#+id/detailServiceTxtPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="-35dp"
android:ellipsize="end"
android:gravity="center"
android:maxLength="50"
android:singleLine="true"
android:textColor="#color/black" />
</LinearLayout>
I get the field value from a web service and set text in java code:
m_txtPhone.setText(m_currentService.PassengerPhone);
In all the devices where I check it this is the result:
But I have a problem in with Samsung J5 (5.1.1). When I try to set text in that TextView (and similars) I have this result:
It seems that I have some problem setting the text or I don't know. Any idea?
NOTE:
I implement the interface in this way because in other cases I do something like this:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical" >
<Button
android:id="#+id/detailServiceBtnClient"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#color/white"
android:drawableRight="#drawable/icon_detail"
android:gravity="left|center_vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="#string/detailServiceBtnClient"
android:textColor="#color/black" />
<TextView
android:id="#+id/detailServiceTxtClient"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="25dp"
android:layout_marginTop="-35dp"
android:ellipsize="end"
android:gravity="center"
android:maxLength="50"
android:singleLine="true"
android:textColor="#color/black" />
</LinearLayout>

You are using LinearLayout. In this layout items are added after each element. Your orientation is vertical, hence, it is below the button. Use RelativeLayout and then use alignTop and alignBottom properties of TextView.
android:alignTop="#+id/button"
android:alignBottom="#+id/button"
android:gravity="center"

Related

Progressbar not displaying when TextView has content

I'm working with a class that extends Dialog. It should display a progressbar element. Sometimes there will be a message, sometimes there isn't.
The progressbar shows when there is no message but does not show when there is a message and I do not understand why.
Here is the layout code:
<TextView
android:id="#+id/dialog_message"
style="#style/arial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_marginBottom="20dp"
android:text=""
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="18sp"
/>
<ProgressBar
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_marginTop="10dp"
android:visibility="gone" />
Here is the java:
public void progressDialog () {
if(this.message.getText().length() > 0){
message.setVisibility(View.VISIBLE);
}else{
message.setVisibility(View.GONE);
}
progress.setVisibility(View.VISIBLE);
leftButton.setVisibility(View.GONE);
rightButton.setVisibility(View.GONE);
}
When message is set GONE the progressbar shows, when message is set VISIBLE the progressbar does not show. I assume it is getting hidden by the message somehow.
I've tried moving it around in the layout as this question might suggest was needed ProgressBar not displaying, but to no avail.
How do I get the progressbar to always show when calling progressDialog()?
Edit***** Added full layout xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/dialog_background"
android:orientation="vertical">
<TextView
android:id="#+id/dialog_title"
style="#style/arialBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginTop="35dp"
android:ellipsize="end"
android:maxLines="1"
android:text="#string/waiting"
android:textColor="#android:color/white"
android:textSize="21sp" />
<TextView
android:id="#+id/dialog_message"
style="#style/arial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="30dp"
android:text=" "
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="20sp" />
<ProgressBar
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_marginTop="30dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/dialog_button_one"
style="#android:style/Widget.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/purple"
android:orientation="horizontal">
<TextView
android:id="#+id/dialog_button_one_text"
style="#style/arialBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="#dimen/alert_dialog_button_margin_left_right"
android:layout_marginRight="#dimen/alert_dialog_button_margin_left_right"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#android:color/white"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/dialog_button_two"
style="#android:style/Widget.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="20dp"
android:background="#color/purple"
android:orientation="horizontal">
<TextView
android:id="#+id/dialog_button_two_text"
style="#style/arialBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="#dimen/alert_dialog_button_margin_left_right"
android:layout_marginRight="#dimen/alert_dialog_button_margin_left_right"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#android:color/white"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
I think you are using linear layout. So use Relative Layout instead of linear layout.
Add a parent constraint layout to your linear layout and move progress bar out of linear layout.
<constraint>
<linear/>
<progress/>
</constraint>
Some thing like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/dialog_background"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
<!-- Your complete layout -->
</LinearLayout>
<ProgressBar
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone" />
</android.support.constraint.ConstraintLayout>
Ok, it looks like you use some wrong property for what you want, look:
android:layout_gravity="center" will put your TextView in center of the layout, but you also set it in your ProgressBar this mean that only one of then will be shown, it is only useful when you want to show one view at time, if you want to show both, try to remove one of this property.
Another thing, you set android:layout_margin="30dp" on TextView, so your progressBar will be far removed from TextView, which may also cause the invisibility of the ProgressBar, try 16dp.
<TextView
android:id="#+id/dialog_message"
style="#style/arial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" // remove here or in ProgressBar
android:layout_margin="16dp" // I just replace 30dp to 16dp
android:text=" "
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="20sp" />
EDIT - Another Answer
I edit your full XML code, replacing some margin with padding, and show the progressBar always. You can now hide/show the textView or progressbar, it should work.
I also replace some property, since I have not it here, make sure to add again. Hope it help you.
I recommend to use RelativeLayout to improve your UI. Below I show the current XML behavior.
When ProgressBar is showed
The full source code on link below, I am unable to paste the code here.
https://gist.github.com/pedromassango/a6dc213823b297931f1ef2e6b6954466

Create Spacing with Percentage Relative Layout

My problem is that I have four Buttons on the screen, I used a PercentageRelativeLayout to place them where I want them and everything was working great.
They even resize!
However, when they do resize, the Buttons start touching each other, and when I make it so they do not touch each other on a tablet, when I go back to a phone the space is too far apart.
Does anyone have any idea on how I could create a spacing that could work on all devices?
Because I thought that PercentageRelativeLayouts were the perfect solution to get things to resize, without using any LinearLayout and it is not working out the way I thought.
Below is my code
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#696969">
<ImageButton
app:layout_widthPercent="40%"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="9%"
app:layout_marginTopPercent="21%"
android:background="#00ff0000"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/opt1"
android:scaleType="fitCenter"
android:id="#+id/purpleButton"
android:layout_align="#+id/option1"
android:longClickable="false" />
<ImageButton
app:layout_widthPercent="40%"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="9%"
app:layout_marginTopPercent="58%"
android:background="#00ff0000"
android:layout_height="fill_parent"
android:src="#drawable/opt2"
android:scaleType="fitStart"
android:id="#+id/option2"
android:layout_width="fill_parent"
android:longClickable="false" />
<ImageButton
app:layout_widthPercent="40%"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="50%"
app:layout_marginTopPercent="58%"
android:background="#00ff0000"
android:layout_height="fill_parent"
android:src="#drawable/opt3"
android:scaleType="fitStart"
android:id="#+id/option3"
android:layout_width="fill_parent"
android:longClickable="false" />
<ImageButton
app:layout_widthPercent="40%"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="50%"
app:layout_marginTopPercent="21%"
android:background="#00ff0000"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/option4"
android:scaleType="fitCenter"
android:id="#+id/opt4"
android:longClickable="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Pick an Answer"
android:id="#+id/pickLabel"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp"
app:layout_widthPercent="100%"
app:layout_heightPercent="7%"
app:layout_marginTopPercent="15%"
android:textColor="#ffffff"
android:textAlignment="center"
android:textSize="30sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_widthPercent="100%"
app:layout_heightPercent="12%"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="00"
android:id="#+id/timeLabel"
android:textAlignment="gravity"
android:textSize="72sp"
android:gravity="center|center_vertical|center_horizontal" />
You can set android:weightSum="1" on the outside layout and android:layout_weight="0.25" for the inside layouts.

Android studio setting layout up like this

I've tried everything I can think of but can't get this layout working. It's a ListView that list matches in a row.
Row one is first match, and next row is second match, and so on. I don't don't mind the green strokes and borders.
Is it even possible?
See the deisgn here:
Here's an example implementation, it does however use negative margins, to overlap the thing I called badge.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#cdcdcd"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/score"
android:layout_below="#+id/badge"
android:background="#color/white"
android:orientation="vertical"
android:padding="16dp"
android:showDividers="middle">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView 1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView 2"/>
</LinearLayout>
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="16dp"
android:text="0 vs 7"
android:layout_below="#+id/badge"
android:textSize="32sp"
android:textStyle="bold"/>
<LinearLayout
android:layout_below="#+id/badge"
android:id="#+id/right_table"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/score"
android:background="#color/white"
android:orientation="vertical"
android:padding="16dp"
android:showDividers="middle">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView 1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView 2"/>
</LinearLayout>
<TextView
android:id="#+id/badge"
android:layout_toRightOf="#id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0f0"
android:layout_marginLeft="-12dp"
android:layout_marginBottom="-8dp"
android:text="Badge"
/>
</RelativeLayout>
To alternate the background simply set the background in getView in your adapter.
You'll need a custom adapter that fills the ListView (better use RecyclerView & an Adapter with ViehHolder), this row layout is taken from my own project, not exactly what you requested, but you'll get the idea. Just comment for further information.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/textV_player1"
android:text="player1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:layout_marginEnd="40dp"
android:textSize="20sp"
android:paddingTop="15dp"
android:gravity="end"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/textV_vs"
android:layout_toStartOf="#+id/textV_vs" />
<TextView
android:id="#+id/textV_player2"
android:text="player2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingTop="15dp"
android:layout_alignBottom="#+id/textV_vs"
android:layout_toRightOf="#+id/textV_vs"
android:layout_toEndOf="#+id/textV_vs" />
<TextView
android:id="#+id/textV_vs"
android:text="vs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:layout_marginEnd="40dp"
android:textSize="20sp"
android:layout_above="#+id/textV_points1"
android:layout_centerHorizontal="true" />
<TextView
android:id="#+id/textV_points1"
android:text="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingTop="3dp"
android:paddingBottom="15dp"
android:layout_below="#+id/textV_player1"
android:layout_alignRight="#+id/textV_player1"
android:layout_alignEnd="#+id/textV_player1" />
<TextView
android:id="#+id/textV_points2"
android:text="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingTop="3dp"
android:paddingBottom="15dp"
android:layout_below="#+id/textV_player2"
android:layout_alignLeft="#+id/textV_player2"
android:layout_alignStart="#+id/textV_player2" />
<TextView
android:id="#+id/textV_vspoints"
android:text=":"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingBottom="15dp"
android:layout_below="#id/textV_vs"
android:layout_centerHorizontal="true" />
</RelativeLayout>

Implementing an adapter for RecyclerView in Android

I am trying to implement the flexible space with image pattern of the material design.
In order to do so, I followed this tutorial.
The problem is, the tutorial uses RecyclerView, and I have another view I'd like to use which is just a simple ScrollView with a relative view:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<TextView
android:id="#+id/loggedInTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/separator1"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:text="#string/profile_logged_in_with_title"
android:textSize="18sp" />
<ImageView
android:id="#+id/loggedInPlatformLogo"
android:layout_width="95dp"
android:layout_height="30dp"
android:layout_alignBottom="#+id/loggedInTitle"
android:layout_centerHorizontal="true"
android:layout_marginBottom="-4dp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/loggedInTitle"
android:background="#drawable/facebook_logo"
android:gravity="center_horizontal|center_vertical" />
<View
android:id="#+id/separator2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignLeft="#+id/separator1"
android:layout_below="#+id/loggedInTitle"
android:layout_marginTop="17dp"
android:background="#android:color/darker_gray" />
<ImageView
android:id="#+id/homeIcon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignLeft="#+id/loggedInTitle"
android:layout_below="#+id/separator2"
android:layout_marginTop="10dp"
android:background="#drawable/home_icon" />
<TextView
android:id="#+id/homeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/homeIcon"
android:layout_marginBottom="4dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/homeIcon"
android:text="#string/profile_home_title"
android:textSize="18sp"
android:textStyle="bold" />
<AutoCompleteTextView
android:id="#+id/homeAddressEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/homeIcon"
android:layout_below="#+id/homeIcon"
android:layout_marginTop="2dp"
android:ems="10"
android:hint="#string/profile_home_address_hint"
android:inputType="textAutoComplete"
android:textSize="16sp" />
<View
android:id="#+id/separator3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignLeft="#+id/separator1"
android:layout_below="#+id/homeAddressEdit"
android:layout_marginTop="8dp"
android:background="#android:color/darker_gray" />
<ImageView
android:id="#+id/workIcon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignLeft="#+id/homeIcon"
android:layout_below="#+id/separator3"
android:layout_marginTop="10dp"
android:background="#drawable/work_icon" />
<TextView
android:id="#+id/workTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/workIcon"
android:layout_marginBottom="4dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/workIcon"
android:text="#string/profile_work_title"
android:textSize="18sp"
android:textStyle="bold" />
<AutoCompleteTextView
android:id="#+id/workAddressEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/workIcon"
android:layout_below="#+id/workIcon"
android:layout_marginTop="2dp"
android:ems="10"
android:hint="#string/profile_work_address_hint"
android:inputType="textAutoComplete"
android:textSize="16sp" />
<View
android:id="#+id/separator4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignLeft="#+id/separator1"
android:layout_below="#+id/workAddressEdit"
android:layout_marginTop="8dp"
android:background="#android:color/darker_gray" />
<ImageView
android:id="#+id/privacyIcon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignLeft="#+id/workIcon"
android:layout_below="#+id/separator4"
android:layout_marginTop="13dp"
android:background="#drawable/privacy_icon" />
<TextView
android:id="#+id/privacyTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/privacyIcon"
android:layout_marginBottom="4dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/privacyIcon"
android:text="#string/profile_privacy_title"
android:textSize="18sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/privacySpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/privacyIcon"
android:layout_below="#+id/privacyIcon"
android:layout_marginBottom="4dp"
android:layout_marginTop="-3dp"
android:entries="#array/profile_privacy_settings"
android:prompt="#string/profile_privacy_title" />
</RelativeLayout>
</ScrollView>
So I tried to replace the RecyclerView in the tutorial's layout xml with a reference to this view, but the result is I can't scroll the view. I guess that's because ScrollView is not compatible with the flexible space pattern.
Next attempt was trying to convert the above ScrollView layout to an adapter in order to use RecyclerView following this Android Developers example, but I have no idea how to do that, since I got too many elements to combine and the example consists of simple array of Strings.
I'd really appreciate a sample of how the Adapter should look like in order to match the layout above, or another easier solution (maybe RecyclerView isn't the best direction), if it exists.
There's a design support library from Google.
Try this website:
http://hmkcode.com/material-design-app-android-design-support-library-appcompat/

Android - strange layout display in custom DialogPreference

I have a custom DialogPreference with my own layout defined. The layout file is as follows:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_password_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword">
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/confirm_password_label"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
/>
On the displayed dialog both TextViews are missing:
What is the reason of TextViews not being displayed?
One of the reason for this behavior is due to manufacturer's customization of themes. Other reasons could be that the selected text appearance has same color as of background. To avoid this, you may simply set a color to your TextView, for e.g.:
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_password_label"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
*Also make sure android:text does have a text to show on screen

Categories