android-ui

How to open numeric keyboard when click on EditText?

久未见 提交于 2019-11-29 10:10:34
问题 I read several other posts and using input.setInputType(TYPE_NUMBER_FLAG_DECIMAL); does open the keyboard but its not the numeric keyboard 回答1: add android:inputType="number" to your edittext in your xml, it will automatically open numeric keyboard when you will click inside edittext. 回答2: Just you this code for your xml file, android:inputType="number" 回答3: Add android:inputType="number" in xml will automatically open numeric keyboard when click on EditText, but this will allow you to enter

Change ActionBar Tabs background color

孤街醉人 提交于 2019-11-29 09:25:51
Is there a way to change the background color of the tab bar in the ActionBar without changing it in the one line version? To clarify what I want: In portrait mode the ActionBar is split in two lines, the ActionBar itself and the tabs below. In landscape mode the tabs are in the actual ActionBar. I want to change the background color of the portrait mode. If I change the background in the TabView it'll be changed for both modes. Do I have to create separate styles for those? Which brings up a second question: is there a way to know when it'll be two lines and when not? Or am I just missing

java.lang.IllegalStateException: ScrollView can host only one direct child [duplicate]

好久不见. 提交于 2019-11-29 09:16:58
This question already has an answer here: How can I avoid “IllegalStateException: Scrollview can host only one direct child”? 7 answers I'm simply trying to add the ability to scroll through this layout by adding a scrollview however every time I attempt to load the layout I'm getting an error stating "java.lang.IllegalStateException: ScrollView can host only one direct child" and I'm unsure why. Any suggestions are much appreciated. SOURCE: <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android

Vintage Thermometer component + SensorSimulator on the Android emulator

心已入冬 提交于 2019-11-29 08:49:33
After I found this nice custom component that analogly (is this the right word?) displays the temperature read from the Android device's temperature sensor, I wanted to test it with the emulator to see how it works so I've found this Sensor Simulator and altered the component's source to work with it. I did manage it to work on en emulated device, however I've done a few lucky guesses and'd like to know what exactly I've done :-) Here are the changes in thermometer's code I had to make to get it to work in conjunction with the temperature sensor simulator: After importing the sensorsimulator

Creating ring shape in Android code

浪尽此生 提交于 2019-11-29 08:48:35
I have the following shape XML: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:a="http://schemas.android.com/apk/res/android" a:shape="ring" a:innerRadiusRatio="3" a:thicknessRatio="8" a:useLevel="false"> <!-- some other stuff goes here --> </gradient> </shape> I would like to use code instead to create this shape, since some things need to be calculated on the fly before I do it, so static pre-defined layout doesn't cut it. I'm new to Android and can't quite figure out how XML translates to code, and there's no RingShape class inheriting from Shape. In addition to answering just this

Android Universal App Approach

元气小坏坏 提交于 2019-11-29 08:38:47
问题 I want to develop an universal app . I am novice to this approach .That means a single apk for both tablet and phone application . I had go through Support Library Fragments My aim is to build different UI for Tablet and Phone inside a single APk . I had read Getting Your App Ready for Jelly Bean and Nexus 7 . This article mention that res/layout/activity_home.xml To take advantage of the extra space on the 7” screen you might provide an alternative layout: res/layout-sw600dp/activity_home

Find out if ActionBar is stacked

痴心易碎 提交于 2019-11-29 06:08:14
问题 If you add tabs to your ActionBar , they will be in an extra stacked ActionBar on phones in portrait mode. Is there an easy way to find out whether this happened? I've attached two screenshots of the YouTube app. The first one shows the normal ActionBar with the tabs in it, the second one shows the tabs in a stacked ActionBar . 回答1: It is possible to find out if there is one or two lines in action bar by is's height. There is method getHeight(), but it will not work in onCreate or onStart ,

How to change border color of radio button in android? [duplicate]

笑着哭i 提交于 2019-11-29 04:34:48
This question already has an answer here: Change Circle color of radio button 18 answers How to change border color of radio button in android? I want to change circle color of android radio button. Thanks in advance. Any help is greatly appreciated. I have try different soluation and concern if any property is there other that drawable image SKK The easiest way to customize(change color) your views. Goto : http://android-holo-colors.com/ Select the color you want for Radio Button Download Output Resources (Download.Zip) Extract zip contents Copy files from extracted zip to your project

[Android - Kitkat ]Get/pick an image from Android's built-in Gallery app programmatically

青春壹個敷衍的年華 提交于 2019-11-29 04:08:46
Try to pick only one particular image from the SD card.I am able to pick images from gallery and Photos app in kikat.But not getting file path when i pick image from recents am getting file path as null. I tried https://stackoverflow.com/a/2636538/1140321 . Sunil Mishra This works for Kitkat public class BrowsePictureActivity extends Activity{ private static final int SELECT_PICTURE = 1; private String selectedImagePath; private ImageView imageView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.browsepicture); imageView =

In Android, how to make Login button disable with respect to EditText?

北城以北 提交于 2019-11-28 23:24:40
问题 If EditText is empty then Login Button has to be disabled. And if EditText has some texts then Login Button has to be enabled. Well you can see this method on Instagram Login. Both fields are empty, Sign in Button is DISABLED. Here Password field is empty, so still Sign in Button is DISABLED. Here both Username and Password field is not empty, So Sign in Button is ENABLED. how to achieve these steps?? here is my code and it doesn't work.. EditText et1,et2; @Override protected void onCreate