android-xml

Option Menu does not appear in Android

 ̄綄美尐妖づ 提交于 2019-12-12 07:27:02
问题 I have this code to create the menu: @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.tip_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MNU_PREV: animateTextViewsPrev(); break; case MNU_NEXT: animateTextViewsNext(); break; } return true; } And the XML: <?xml version="1.0" encoding="utf-8"?> <menu xmlns

Can't figure out why scrollview is not scrolling

天大地大妈咪最大 提交于 2019-12-12 06:54:03
问题 I'm making a simple converter app. Trying to convert input and display it in the EditTexts below but my ScrollView doesnt work.(Literally does nothing) I use ConstraintLayout as root and I have LinearLayout inside it which is the root of ScrollView. So, What am I missing here? <?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" xmlns:tools="http:/

Pressing back button shows same activity

◇◆丶佛笑我妖孽 提交于 2019-12-12 06:47:12
问题 I have two Activities. LoginActivity HomeScreen I also have a splash screen with this setting: <activity android:name=".SplashScreen" android:theme="@style/AppTheme.NoActionBar" android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> The Splash Screen then transfers the user to the HomeScreen by using this code: Intent intent = new Intent(SplashScreen.this,

Android Building Your First App Basics

爷,独闯天下 提交于 2019-12-12 04:38:35
问题 I'm having a difficult time getting the results that should be displayed as described in the second step of the First App project on the android developer website: developer.android.com/training/basics/firstapp/starting-activity.html#receivetheintent I've created the first intent and copied all other code however upon running the project I receive a blank android screen with no input elements. Here's what the emulator looks like: http://s1278.beta.photobucket.com/user/cetmrw791346/media/1

Android XML referencing via dollar sign vs dot sign

霸气de小男生 提交于 2019-12-12 04:21:21
问题 Why is Android using $ sign to reference nested class, instead of standard . sign. As far as I know, in Java $ is related to inner class context (in stacktrace). <view class="path.to.Outer$Nested" ... /> In data-binding . sign is being used to reference nested class as expected: <variable name="..." type="path.to.Outer.Nested" /> 回答1: Because the inner class is not static. class Parent { class Child { } } would result in Parent$Child while class Parent { static class Child { } } would be

How to add many values in android:tag

浪尽此生 提交于 2019-12-12 03:53:59
问题 In Android XML, I want to add multiple values in android:tag. I found one way that we can use multiple for adding values. <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"> <tag android:id="@+id/value_one" android:value="@string/value_one"/> <tag android:id="@+id/value_two" android:value="@string/value_two"/> <tag android:id="@+id/value_three" android:value="@string/value_three"/> </TextView> But this method work only in API level

Draw bubble programmatically with arrow

你。 提交于 2019-12-12 03:37:22
问题 I am implementing the following Class from Stackoverflow https://stackoverflow.com/a/20811323/1936925 but I need a bubble like this I am trying a lot, but don't know how to do it. What edits do I need to do in order to get the above drawable. 回答1: Try this: public Bitmap overlay(Bitmap image, String content) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inScaled = false; options.inPreferredConfig = Bitmap.Config.ARGB_8888; //My bg bitmap, use yours Bitmap background =

Trying to get drawable resource ID from its name in Android

北城余情 提交于 2019-12-12 03:27:00
问题 I have a resource file like this: strings.xml <string name="category01">My Category 01</string> <string name="category02">My Category 02</string> <string name="category03">My Category 03</string> <string-array name="array_category_01"> <item name="title">@string/category01</item> <item name="image">@drawable/img01</item> </string-array> <string-array name="array_category_02"> <item name="title">@string/category02</item> <item name="image">@drawable/img02</item> </string-array> <string-array

Multi color Stroke image with XML

我与影子孤独终老i 提交于 2019-12-12 03:23:30
问题 Does it possible to create multi-color stroke with the help of XML? I want to create exact view attached here. Thanks 回答1: You could use a trick by creating a drawable shape with gradient and make it a parent's background... something like this: gradient_stroke.xml (in res/drawable): <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle" > <gradient android:angle="180" android:startColor="#fff96200"

Vectors throwing Resources$NotFoundException after updating support library from 23.v to 24.v

天大地大妈咪最大 提交于 2019-12-12 03:04:35
问题 Everything was working fine while on support lib 23 but after updating support lib to ver 24, i am getting crash exceptions on pre-lollipop devices for layer-list which have vector drawable in them which ultimately leads to Resources$NotFoundException. Any idea why? FYI, everything else is working fine, eg. vector in imageview, runtime vector drawable usage and yes i have configured gradle properly. Adding stack trace for better understanding. Fatal Exception: java.lang.RuntimeException: