UI Alignment - Could not resolve - android

I have tried many ways and i could not get this alignment issue resolved . And i am not sure that where i am going wrong .
My XML :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:background="#color/popover">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textColor="#000000"
android:layout_marginTop="15dp"
android:layout_marginBottom="2dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textColor="#000000"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textColor="#000000"
android:layout_marginTop="2dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text"
android:textColor="#000000"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_margin="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textColor="#000000"
android:layout_margin="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textColor="#000000"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="15dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" >
<ImageButton
android:id="#+id/locationalert_dont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#drawable/dontallow_btnaction" />
<ImageButton
android:id="#+id/locationalert_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:background="#drawable/ok_btnaction" />
</LinearLayout>
</LinearLayout>
And the class file :
public void showLocationDialog()
{
Dialog dialog = new Dialog(Homescreen.this);
dialog.setContentView(R.layout.locationalert);
TextView tv1 = (TextView)dialog.findViewById(R.id.textView1);
TextView tv2 = (TextView)dialog.findViewById(R.id.textView2);
TextView tv3 = (TextView)dialog.findViewById(R.id.textView3);
TextView tv4 = (TextView)dialog.findViewById(R.id.textView4);
TextView tv5 = (TextView)dialog.findViewById(R.id.textView5);
TextView tv6 = (TextView)dialog.findViewById(R.id.textView6);
ImageButton ok = (ImageButton)dialog.findViewById(R.id.locationalert_ok);
ImageButton dont = (ImageButton)dialog.findViewById(R.id.locationalert_dont);
dialog.show();
}
Actually i have a button in a class and click on it pop-ups this dialog . But the dialog appears as
In the Screenshot , i am getting a header black bar along with the pop-up dialog and i am not sure how to remove it .
Any related answers are advisable . Thanks in advance .

try below code :-
final Dialog dialog = new Dialog(ActivityName.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // hide title bar
dialog.setContentView(R.layout.vip_services_other_dialog);
// hide black background
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
refer link

Use
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Please also go through:
Android Window and Related Flags and Dialogs

In your XML(locationalert), set Linear Layout Background as:
android:background="#android:color/transparent"
and in your showLocationDialog() method, add
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(R.color.YOURCOLOR));

this is the solution of your problem
Dialog dialog = new Dialog(Homescreen.this,android.R.style.Theme_Translucent_NoTitleBar );
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.locationalert);

You can hide the title bar and the background of a dialog like this:
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
Hope this helps..:)

Related

Instagram options menu from bottom

In the current version of instagram app (Todays date 24-06-2021) ,inside the profile activity/fragment when hamburgur button is pressed (or simply the 3 line icon) now a menu pops up from bottom and can be scroll down by swipe down ,previously when cliked it opens a new fragment/activity
im in love with this animation or a view and im despirat to implement it in my app
but the problem is i dont know what it is called
i want to know what it is exactly and also similar kind of animation or a view is also there in pintrest app
Screen Shot
Update 1
how can i navigate to a fragment from a bottom sheet for eg if in my bootomsheet there is 3 textview i want that if any textView is cliked it should open the respected new fragment i.e if a editprofle textView is clicked it open the editprofile fragment this is how my bottomsheet opens up
Profile_Fragment.java
accountSettings the imageView when clicked the bottomSheetopens up
accountSettings.setOnClickListener(
v -> {
BottomSheet bottomSheet = new BottomSheet();
bottomSheet.show(requireActivity().getSupportFragmentManager(), bottomSheet.get Tag());
}
);
bottom_sheet_profile.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="#+id/slidedownview"
android:layout_width="40dp"
android:layout_height="3dp"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:background="#drawable/rounded_corner_bottomsheetline"
android:layout_marginTop="11dp"/>
<TextView
android:id="#+id/settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/slidedownview"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:layout_marginTop="20dp"
android:elevation="10dp"
android:text="#string/settings"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="normal" />
<TextView
android:id="#+id/edit_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/settings"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:layout_marginTop="17dp"
android:elevation="10dp"
android:text="#string/edit_profile"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="normal" />
<TextView
android:id="#+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/edit_profile"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:layout_marginTop="17dp"
android:elevation="10dp"
android:text="#string/favorite"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="normal" />
<TextView
android:id="#+id/log_out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/favorite"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:layout_marginTop="17dp"
android:layout_marginBottom="15dp"
android:elevation="10dp"
android:text="#string/log_out"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="normal" />
</RelativeLayout>
Include the following library in your app.gradle file.
implementation 'com.google.android.material:material:<version>'
create custom layout bottom_sheet_dialog_layout.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Settings"
android:drawableStart="#drawable/ic_settings"
android:layout_gravity="center_vertical"
android:padding="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Archive"
android:drawableStart="#drawable/ic_archive"
android:layout_gravity="center_vertical"
android:padding="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your Activity"
android:drawableStart="#drawable/ic_activity"
android:layout_gravity="center_vertical"
android:padding="8dp"/>
....
....
....
in Class file
final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
bottomSheetDialog.setContentView(R.layout.activity_sof);
TextView settings = bottomSheetDialog.findViewById(R.id.settings);
TextView archive = bottomSheetDialog.findViewById(R.id.archive);
TextView your_activity = bottomSheetDialog.findViewById(R.id.activity);
...
...
...
bottomSheetDialog.show();
If you want to click event
settings.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Copy is Clicked ", Toast.LENGTH_LONG).show();
bottomSheetDialog.dismiss();
}
});

Remove unnecessary space from AlertDialog

I have an AlertDialog that I set a custom view to. In Android Studio's layout preview it shows what I expect the layout to look like:
However when the app runs on my Nexus 6P it looks like this (Note the extra space at the top, that is what I do not want):
As suggested here I tried changing how the layout was set to:
alertDialog2.setView(view2,0,0,0,0);
alertDialog2.show();
However this did not solve my problem. Any suggestions for how to accomplish this?
XML Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:text="Suggest improvements or changes, or report bugs."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:id="#+id/textView5"
android:textColor="#color/Black"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp">
<EditText
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="#+id/email_feedback_text"
android:layout_marginLeft="125dp"
android:layout_width="250dp"
android:layout_alignParentBottom="false"
android:layout_marginRight="5dp" />
<TextView
android:text="E-mail*:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:id="#+id/textV5"
android:textColor="#color/Black"
android:layout_alignParentLeft="true"
android:layout_marginLeft="30dp" />
</RelativeLayout>
</RelativeLayout>
Java:
AlertDialog.Builder alertDialogBuilderComplete = new AlertDialog.Builder(
MainActivity.this);
alertDialogBuilderComplete.setCancelable(false);
alertDialogBuilderComplete.setTitle("Submit Feedback"); //Set the title of the box
alertDialogBuilderComplete.setMessage("");
alertDialogBuilderComplete.setNegativeButton("Submit",null);
alertDialogBuilderComplete.setPositiveButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel(); //when they click dismiss we will dismiss the box
}
});
alertDialog2 = alertDialogBuilderComplete.create(); //create the box
alertDialog2.setOnShowListener(new DialogInterface.OnShowListener(){
#Override
public void onShow(DialogInterface dialog) {
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
button.setOnClickListener(new View.OnClickListener() {
}
});
}
});
alertDialog2.setView(view2,0,0,0,0);
alertDialog2.show();
Remove this line:
alertDialogBuilderComplete.setMessage("")
Or change it to:
alertDialogBuilderComplete.setMessage(null)
After you posted your xml, I see android:layout_marginTop="20dp" make it android:layout_marginTop="0dp"
<TextView
android:text="Suggest improvements or changes, or report bugs."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:id="#+id/textView5"
android:textColor="#color/Black"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:text="Suggest improvements or changes, or report bugs."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
// remove margin top
android:id="#+id/textView5"
android:textColor="#color/Black"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" />
........
.......
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
// remove margin top, can be added margin as needed
<EditText
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="#+id/email_feedback_text"
android:layout_marginLeft="125dp"
android:layout_width="250dp"
android:layout_alignParentBottom="false"
android:layout_marginRight="5dp" />
......
..........
</RelativeLayout>

Android textview and edit text data passing

I want to pass the contents to the text view from the edit text by using button click and also show notification that Notice posted. How to do that?? I Am new to android. Please help, if possible give a code to do the same. Please post the java code if possible. Thank You..!!
My XML code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="RECENT NOTICES"
android:id="#+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#ff0612"
android:textSize="30dp"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/noticeText"
android:hint="Post Notice"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/textView"
android:layout_alignEnd="#+id/textView" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/sndnoticeBut"
android:src="#drawable/send1"
android:background="#null"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/textView"
android:layout_toEndOf="#+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_above="#+id/noticeText"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/sndnoticeBut"
android:src="#drawable/send1"
android:background="#null"
<!-- Add the onClick -->
android:onClick="sendToTV"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/textView"
android:layout_toEndOf="#+id/textView" />
Do the following in the Activity containing the layout
public void sendToTV(){
String myText = null;
TextView tv = (TextView) findViewById(R.id.noticeText);
EditText et = (EditText) findViewById(R.id.textView);
myText = et.getText.toString();
tv.setText(myText);
}
On your button click your_textview.setText(your_edittext.getText().toString());
For local notification http://www.vogella.com/tutorials/AndroidNotifications/article.html

Popup message like Dialog

I'm actually coding an app for Android and I need some help to do something.
I need to do a kind of popup message with this image: http://img716.imageshack.us/img716/9331/postitz.png. This image must have 2 TextView, one of them is a title and the other one is the message.
I have tried some options like Dialog with its own layout, own style, but the image fills all the screen instead of wrap the content of the TextViews. I have also tried to do it with a new Activity and occurs the same, the Image fills all the screen.
My actual layout is this:
<?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="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
android:background="#android:color/white">
<LinearLayout
android:id="#+id/img_postit"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#drawable/postit"
android:orientation="vertical">
<TextView
android:id="#+id/note_titulo"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="30dp"/>
<TextView
android:id="#+id/note_descr"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="30dp"/>
</LinearLayout>
</LinearLayout>
But I have tried with a lot of different combinations, RelativeLayout, FrameLayout, and I cannot find the solution to do this.
Any idea of how to resolve it?.
Thank's for all.
you said you used as a new activity. Did you use android:theme="#android:style/Theme.Dialog in your manifest file?
And be sure that the image is little bit smaller one such that it will be suitable to act as a pop up..
If you used a dialog what exactly is the problem? Didnt you get the dialog as a pop up ?
(i think the image is larger so that it might fill the entire screen)
Create your own class extending dialog.And use layout like following. I use this in one of my apps and the dialog window is wrapped around the buttons :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/background"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/ll2"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_below="#+id/ll1"
android:gravity="left"
android:orientation="horizontal"
android:paddingBottom="5dp" >
<RadioButton
android:id="#+id/start"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="#+id/stop"
android:background="#drawable/start_on"
android:button="#android:color/transparent"
android:checked="true" />
<RadioButton
android:id="#+id/stop"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:background="#drawable/stop_off"
android:button="#android:color/transparent" />
<RadioButton
android:id="#+id/restart"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/stop"
android:background="#drawable/restart_on"
android:button="#android:color/transparent" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/lltext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/detail_credit"
android:layout_below="#+id/ll2"
android:layout_marginBottom="15dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/startText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/stopText"
android:text="#string/start_server_icon"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/white"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/stopText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:text="#string/stop_server_icon"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/white"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/restartText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/stopText"
android:text="#string/restart_server_icon"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/white"
android:textSize="12sp"
android:textStyle="bold" />
</RelativeLayout>
<Button
android:id="#+id/dialogButtonOK"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_below="#+id/lltext"
android:layout_centerHorizontal="true"
android:text="OK" />
</RelativeLayout>
final Dialog dialog_my = new Dialog(FIRST.this,
android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
dialog_my.setContentView(R.layout.about_us); //<PUT YOUR LAYOUT ID HERE>
TextView date = (TextView) dialog_my.findViewById(R.id.date);
TextView thought = (TextView) dialog_my.findViewById(R.id.thought);
TextView ok = (TextView) dialog_my.findViewById(R.id.ok);
TextView link = (TextView) dialog_my.findViewById(R.id.link);
TextView contact = (TextView) dialog_my.findViewById(R.id.contact);
WindowManager.LayoutParams lp = dialog_my.getWindow().getAttributes();
lp.dimAmount = 0.0f;
dialog_my.getWindow().setAttributes(lp);
dialog_my.getWindow().addFlags(
WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog_my.show();

Visibility of TextView in Dialog

I have a dialog, which is created with this code:
final Dialog dialog1 = new Dialog(Test.this);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.setContentView(R.layout.test_layout);
dialog1.setCancelable(true);
...
The layout file 'test_layout.xml' contains a typical TextView:
<TextView
android:id="#+id/tv_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Test" />
I want in the code to set this TextView invisible (gone) in some cases.
I tried following:
TextView tv = (TextView) dialog1.findViewById(R.id.tv_username);
tv.setVisibility(TextView.GONE);
But the TextView still appears in the dialog. If I set in the layout xml file android:visibility="gone" it is not appearing in the dialog. But I need to do it via code.
Here the whole code:
if (whichButton == 1) {
final Dialog dialog1 = new Dialog(Test.this);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.setContentView(R.layout.test_layout);
dialog1.setCancelable(true);
TextView tv = (TextView) dialog1.findViewById(R.id.tv_username);
tv.setVisibility(View.GONE);
...
dialog1.show();
}
Here the whole XML file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="250dp"
android:layout_height="match_parent"
>
<TextView
android:id="#+id/tv_name"
android:paddingTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:textSize="14dp"
android:text="Name:" />
<EditText
android:id="#+id/username"
android:hint="#string/enterName"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:maxLength="15"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:scrollHorizontally="true"
android:capitalize="words"
android:singleLine="true"
android:gravity="fill_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/tv_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Test" />
<TextView
android:id="#+id/tv_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:textSize="14dp"
android:text="#string/message" />
<EditText
android:id="#+id/tip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:maxLength="290"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:capitalize="words"
android:gravity="fill_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/button"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/send_message" />
</LinearLayout>
Try tv.setVisibility(View.INVISIBLE);
I found a solution or workaround.
The dialog was created in the the onClick method of an AlertDialog.
Now I use the showDialog() method and handle it in the corresponding callback method.
There it is working fine.
I do not understand why this is working, but I only want to tell other users how they can solve this issue.
I would be happy if someone can come up with a clarification.

Categories

Resources