Android Emulator Keyboard tab key navigation is not working - android

I'm using EclipseADT to develop apps. Now, the emulator keyboard works fine and I'm able to enter the values in EditTexts, but the tab navigation doesn't work and it's cumbersome to click through each EditText when there are many fields. I've already ensured that the hardware is enabled in my device configuration as suggested in this answer:
hw.keyboard=yes
From my observation, this has started occurring since I also installed AndroidStudio besides Eclipse just to test this IDE. But after installing AS, I'd also updated the AndroidSDK, so it might be caused due to that also.
UPDATE: New Day Entry Screen

This issue got resolved after I changed the layout xml of my activity as follows:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/newdayLayout"
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"
tools:context="com.prahladyeri.android.droidwells.NewDayActivity" >
<TextView
android:id="#+id/lblnewdaySiteName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="Some very long site name"
android:textStyle="bold" />
<TextView
android:id="#+id/lblnewdayDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/lblnewdaySiteName"
android:text="01/01/2015" />
<Button
android:id="#+id/cmdnewdayEditDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/lblnewdayDate"
android:text="Edit Date" />
<Button
android:id="#+id/cmdnewdaySave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="SAVE" />
<Button
android:id="#+id/cmdnewdayCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/cmdnewdaySave"
android:layout_alignTop="#+id/cmdnewdaySave"
android:text="Cancel" />
<Button
android:id="#+id/cmdnewdayTanks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/cmdnewdayCancel"
android:layout_alignTop="#+id/cmdnewdayCancel"
android:text="Tanks" />
</RelativeLayout>

Related

EditText disappears on Android Marshmallow 6.0 devices

This is how my xml layout file in IDE looks like:
It looks like that on every device BUT Marshmallow ones, which ended up looking like this:
As you can see, the password EditText and Remember CheckBox disappeared without a trace, yet I still can declare them in the class file normally.
This is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_log_in"
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"
tools:context="my.app.LogInActivity">
<!-- Dummy item to prevent AutoCompleteTextView from receiving focus -->
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="0px"
android:layout_height="0px"
android:id="#+id/linearLayout5"
android:orientation="horizontal" />
<!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component
to prevent the dummy from receiving focus again -->
<AutoCompleteTextView android:id="#+id/autotext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusUp="#id/autotext"
android:visibility="invisible"
android:nextFocusLeft="#id/autotext"
android:textSize="15sp" />
<TextView
android:id="#+id/txtname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txt_customer"
android:layout_alignBottom="#+id/txt_customer"
android:text="Name"
android:textSize="14sp" />
<EditText
android:id="#+id/txt_customer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="#+id/autotext"
android:layout_toEndOf="#+id/bt_exit"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPersonName"
android:maxLength="100"
android:textSize="15sp" />
<EditText
android:id="#+id/txt_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_alignParentEnd="true"
android:layout_alignStart="#+id/txt_customer"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="100"
android:textSize="15sp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtname"
android:layout_alignStart="#+id/txtname"
android:layout_below="#+id/txt_customer"
android:layout_marginTop="25dp"
android:text="Pasword"
android:textSize="14sp" />
<Button
android:id="#+id/bt_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:text="LogIn"
android:textColor="#000000" />
<Button
android:id="#+id/bt_exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toEndOf="#+id/linearLayout5"
android:text="Quit"
android:textColor="#000000" />
<CheckBox
android:id="#+id/check_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/txt_password"
android:layout_below="#+id/txt_password"
android:text="Remember" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout5"
android:layout_toEndOf="#+id/linearLayout5"
android:text="Log In" />
The Name EditText and Password EditText are the same yet only the Password one disappears on Marshmallow 6.0 devices. I have already tried to change theme, Build Target, position but it's still the same. What had go wrong?
EDIT #1:This question mentioned "messy code" and it was solved by "cleaning up" the code. I am using RelativeLayout as parent like him, but changing to LinearLayout isn't viable.
EDIT #2: I tried to preset a value just to login, and it worked normally like I just typed it in manually. Inside layouts file are the same: Only one EditText appears, the rest (EditText, CheckBox, RadioButtons) disappear. What is going on?? Example:
On Marshmallow:
Solved the disappearing bug. From this SO answer which leads me to this Google issue. I have to delete android:layout_alignBaseline attribute and they will render fine.

Not displaying check box on other device

This is very strange. I have two Asus MeMo Pad 7 devices. One of them runs everything perfectly but the other has a strange quirk where two check boxes on one of the screens are not being displayed. One is required to be checked before proceeding so this is a complete fail.
Both devices are identical and running Android OS 4.4.2.
Why is this happening and what can I do to resolve? While it would be bad enough if the devices were different and running differing versions of Android, these are identical so very bad. I'm worried now as to what else could be wrong?
Thanks in advance
Conor
UPDATE:
Out of four identical devices, 3 are running correctly. I will need to check specifics of Kernel Version etc. In case it is relevant all installations came from HockeyApp. The offending device is remote so I cannot install via ADB right now.
UPDATE:
Please see the image where the issue is occurring. The red dots are where the check boxes should be appearing.
Following the image is the XML layout.
XML Layout:
<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="match_parent"
android:background="#color/Company_grey"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="ie.Company.android.dws.ActivityMain" >
<ImageView
android:id="#+id/imgCompanyLogo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:contentDescription="#string/Company_logo"
android:src="#drawable/Company_main_logo" />
<TextView
android:id="#+id/lblBeforeWeBegin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/imgCompanyLogo"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:gravity="center"
android:text="#string/Registration_Prompt"
android:textColor="#color/Company_green"
android:textSize="30sp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/lblBeforeWeBegin"
android:layout_centerHorizontal="true"
android:layout_marginTop="80dp"
android:background="#color/Company_grey" >
<EditText
android:id="#+id/txtName"
android:layout_width="450dp"
android:layout_height="45dp"
android:background="#drawable/rounded_edittext"
android:hint="#string/Name"
android:inputType="text|textCapSentences|textPersonName"
android:paddingLeft="10dp"
android:textColor="#color/Company_blue" />
<EditText
android:id="#+id/txtNickname"
android:layout_width="450dp"
android:layout_height="45dp"
android:layout_below="#id/txtName"
android:layout_marginTop="25dp"
android:background="#drawable/rounded_edittext"
android:hint="#string/Nickname"
android:inputType="text"
android:paddingLeft="10dp"
android:textColor="#color/Company_blue" />
<EditText
android:id="#+id/txtEmail"
android:layout_width="450dp"
android:layout_height="45dp"
android:layout_below="#id/txtNickname"
android:layout_marginTop="25dp"
android:background="#drawable/rounded_edittext"
android:hint="#string/Email"
android:inputType="textNoSuggestions|textEmailAddress"
android:paddingLeft="10dp"
android:textColor="#color/Company_blue" />
<CheckBox
android:id="#+id/chkAgreeTermsConditions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/txtEmail"
android:layout_marginTop="25dp" />
<TextView
android:id="#+id/lblAgreeTermsConditions"
android:layout_width="405dp"
android:layout_height="wrap_content"
android:layout_below="#id/txtEmail"
android:layout_marginLeft="10dp"
android:layout_marginTop="23dp"
android:layout_toRightOf="#id/chkAgreeTermsConditions"
android:text="#string/AgreeTermsConditions"
android:textColor="#color/Company_green"
android:textSize="25sp" />
<CheckBox
android:id="#+id/chkOptInMarketing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/chkAgreeTermsConditions"
android:layout_marginTop="25dp" />
<TextView
android:id="#+id/lblOptInMarketing"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:layout_below="#+id/lblAgreeTermsConditions"
android:layout_marginLeft="10dp"
android:layout_marginTop="25dp"
android:layout_toRightOf="#id/chkOptInMarketing"
android:text="#string/OptInMarketing"
android:textColor="#color/Company_green"
android:textSize="25sp" />
<Button
android:id="#+id/btnStartQuiz"
android:layout_width="450dp"
android:layout_height="100dp"
android:layout_below="#id/chkOptInMarketing"
android:layout_marginTop="50dp"
android:background="#drawable/rounded_button"
android:text="#string/Start_Quiz_exclamation"
android:textColor="#color/white"
android:textSize="65sp" />
</RelativeLayout>

Alert in activity_main.xml page in android

I have an alert dialog in activity_main.xml page.
I have tried quite a few combinations and am unable to resolve the alert.
This is beginning to make me believe my structure as a whole is not correct.
This seems like there should be an easy fix.
What am I missing ?
Alert:
Consider adding android:layout_alignStart="#+id/button1" to
better support right-to-left layouts
In this line of my xml page :
android:layout_alignLeft="#+id/button1"
My xml code below.
Thanks in advance.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="#+id/ccmexRelativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00688B"
android:gravity="top"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:id="#+id/image"
android:layout_width="300dp"
android:layout_height="500dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#drawable/collage"
android:contentDescription="#null" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="30dp"
android:background="#EAEAAE"
android:text="#string/welcome"
android:textColor="#5C3317"
android:textSize="20sp"
android:textStyle="bold"
android:width="150sp" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignLeft="#+id/button1"
android:layout_below="#+id/button1"
android:layout_marginTop="14dp"
android:background="#EAEAAE"
android:text="#string/work"
android:textColor="#5C3317"
android:textSize="20sp"
android:textStyle="bold"
android:width="150sp" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image"
android:layout_alignRight="#+id/image"
android:text="#string/group"
android:textColor="#color/text_color"
android:textSize="12sp" />
</RelativeLayout>
</ScrollView>
The problem is layout_alignStart is supported from Android 4.2 (API level 17). The alert is just a warning, layout_alignLeft works just fine but if it bothers you then you can add it to your code but keep layout_alignLeft for compatibility.
You can read about it here.
Dialogs come on top of the UI.
See documentation here : http://developer.android.com/guide/topics/ui/dialogs.html

Number picker in android not showing properly

I'm starting to build an app with android studio and right away I'm having a bit of an issue. Currently my number pickers look like this in the XML preview:
But when I run the app (on the emulator) it looks like this:
There is a text view that you can't see in the preview but appears when the app is run, that is why you see the text "Time's up" in the emulator screenshot. What I'm wondering is why are the number pickers so close to my textview and off to the left? I don't mind the change in style (in fact I welcome it) but I can't figure out why they moved. Any help is greatly appreciated! Here is my XML code:
<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="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="com.skytbest.intervaltrainer.MainActivity">
<TextView
android:id="#+id/timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:paddingRight="10dip"
android:paddinBottom="50dip"
android:textSize="50dp"
/>
<Button
android:id="#+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Start" />
<NumberPicker
android:id="#+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/timer"
android:layout_toLeftOf="#+id/timer"
android:paddingTop="50dp" />
<NumberPicker
android:id="#+id/numberPicker2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/numberPicker"
android:layout_toRightOf="#+id/numberPicker"
android:paddingTop="50dp" />
</RelativeLayout>
Here is a working layout using the suggestion in my comment. Note that it is helpful to put some text in the TextView to better enable the UI designer to show the layout. Even then it sometimes does not match what you see on screen, especially when you have invalid combinations of layout constraints.
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
tools:context="com.skytbest.intervaltrainer.MainActivity">
<TextView
android:id="#+id/timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:text="Label"
android:paddingBottom="50dp"
android:paddingTop="50dp"
android:textSize="50dp"
/>
<Button
android:id="#+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Start"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#id/timer">
<NumberPicker
android:id="#+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<NumberPicker
android:id="#+id/numberPicker2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
You need to set setMinValue and setMaxValue otherwise it will get stack on 0.

Android Button text not centered when using API 17 for rendering

In the graphical view of layout, when I choose API 15 or lower from the button shown in the image below, the text in the encircled buttons looks fine.
When I choose API 17, the text is displaced even though the xml code is same. Changing the button padding does not help.
Is this just a problem with Eclipse or is it possible that new versions of android may see this displaced text?
What's the workaround to fix this?
XML code:
<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="match_parent"
tools:context=".HomeActivity" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="3dp" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:src="#drawable/label" />
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_below="#+id/linearLayout1"
android:layout_marginTop="20dp"
android:text="#string/about_title"
android:textSize="20sp" />
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_alignRight="#+id/linearLayout1"
android:layout_below="#+id/textView1"
android:layout_marginTop="5dp"
android:text="#string/temp" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_alignRight="#+id/textView2"
android:layout_below="#+id/textView2"
android:layout_marginTop="20dp"
android:baselineAligned="false" >
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/news" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/tournaments" />
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/results" />
</LinearLayout>
android:gravity="center" did not help
I restarted eclipse twice. Strangely it did not help in the first restart but it looked fine after the second one. Also, its working fine on device.
Apologies for the question, I must have waited before posting the question.
Not sure if the default style for Buttons changed in API17... possibly...
Anyway, adding android:gravity="center" should be fixing this for you.
i don't know i faced this problem check restart a eclipse.. and check..
adding android:gravity="center" should be fixing this for you

Categories

Resources