Maybe this question has been asked before, but I couldn't find a precise answer. I have implemented the RecyclerView widget as a list in my L test application and I want to get the 'material effect' when you click on an item form the list. I implemented an onClickListener in my ViewHolder creation and set the attribute
android:background="?android:attr/selectableItemBackground"
as a background to my list item layout (to the parent).
But none of this worked. When I click on the items NOTHING happens'. There is no effect, holo, material, none... Please point out if I am doing something wrong here... Thx
Sandra's answer didn't work for me. I needed one more property in my list item layout:
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
Note: if you get an error when pasting in the last line, then your android app is set on version 10 or below. Just right click on the error in Android Studio and set it so it will create a v11 version of your layout as well. Then, in the original layout, make sure to delete
android:background="?android:attr/selectableItemBackground"`
This is because the animation isn't supported in v10 versions of android or lower. With these two layout files set up, the animation will correctly show in v11+ versions of Android and of course it won't be shown in lower versions.
(or just increase the minSdkVersion version of your app to higher than 10)
I made a silly mistake and did not put
android:clickable="true"
android:focusable="true"
to my list item layout. I think this was not required pre L, but it doesn't matter because that was the problem in this case.
android:clickable="true"
android:focusable="true"
these lines are no longer used. just adding
android:background="?android:attr/selectableItemBackground"
working for click effect.
Related
I completed Unity's roll-a-ball tutorial and it works fine. I changed a couple of materials to make it look better. I also added a C# script that should restart the level when the player falls off of the ground (I disables the walls). I am using Unity 5.5.
It initially looks like this:
But when I go off the edge and the level restarts, it looks like this:
It sometimes looks like this for a few seconds after opening unity when the editor is loading.
Here is the script:
using UnityEngine;
using System.Collections;
public class DeathTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.CompareTag("Player"))
Application.LoadLevel(Application.loadedLevel);
}
}
Any ideas on what's causing this?
The colors and materials are loaded. This is a lighting problem because lighliting is still calculating in the background. This will likely occur in the Editor only. This should not happen in the build.
Depending on your Unity version, you can fix this by going to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.
For older version of Unity with no Auto Generate checkbox, see here.
After play with Lighting tools, only one thing should be change on Lighting Setting for every scene.
Window > Rendering > Lighting (Unity 2020)
Click at Environment Tab
At Environment Lighting, change Source from Skybox to Color.
Select white color from Ambient Color.
Done. Try test it.
Before
After
I found many solutions online but I was missing out a step, so I hope this helps.
Most solutions indicated to go to Windows->Lightning, then untick Auto and Click Generate Lighting. My problem was that while I was pressing the generate button I did not have all of my scenes loaded for preview (at least not the scene I had problems with), so it was only applying light generation to the loaded scenes. Make sure all scenes are loaded when generating the lights.
Try Clearing Baked Data if you are using unity version around 5.5
Go to Windows->Lightning->Untick Auto->Now Click dropdown arrow of Build Button which is near Auto(Check Box) -> Select Clear Baked Data.
Now try Your code which looks fine although SceneManager.LoadScene (1); is enough.
Also unloading the previous scene and setting new scene as active scene is a good practice.
This worked for me.
File > Build settings > player Settings > (on the left) Graphics > (Top-Right) gear icon > Reset
I'm a newbie and none of the advice on web helped me. However when I went to Window > Rendering > Lightning > scene tab; If "lightning setting" says “none”, click on it and choose “demo”- setting. Press “generate”.
So it seems like it was missing settings all together which made the scene go dark when loaded.
I encountered the exact same problem. What worked for me was to set Directional Light > Light > Mode to Realtime. (it was Baked, for some reason)
I hope this can help someone in the future.
I am working on an application build on Dojo 1.4 and currently used on IE8.
When tried to run IE10 Compatibility view, I observer some X (to clear the data) are being show in the fields like dijit.form.Select. While in IE8 it doesn't display them
Please guide to remove them or what basically is happening
Thanks in Advance
If this is the same problem I just fixed then the question isn't referring to the IE10 "clear field" X. It's referring to a very large text "X" character that is displayed in the Select widget in addition to the options that are supposed to be there, making the widget twice as tall as it should be.
In my case it was because I was mixing the CSS stylesheet from one Dojo version with the API's from another. Check to make sure that your stylesheet and dojo.js versions match. For example, in my case the stylesheet was:
...href="//ajax.googleapis.com/ajax/libs/dojo/1.7.5/dijit/themes/claro/claro.css" media="screen">
while the script being included was
... src="//ajax.googleapis.com/ajax/libs/dojo/1.10.1/dojo/dojo.js"></script>
I blame the fact that I was modifying Dijit sample code without knowing what the heck I was doing...
When it comes to the launch screen I can't find a unifying way to mimic the look of the application on both iOS6 and iOS7 (supporting both). Are we forced to make a regular splash screen of a logo or similar if we have a toolbar menu or do you guys have any great ideas how to solve it?
Short answer
In iOS 7, an app can use a different launch image depending on which version of iOS it’s running in. To provide different launch images, add the UILaunchImages key to the Info.plist file and use a dictionary to describe each launch image.
Background
It uses the following keys:
UILaunchImageName - A string containing the name of the PNG image file. The image file must reside at the top level of the app bundle.
The name you specify for this key should not include a filename
extension, nor should it include modifiers such as #2x, -568h,
~iphone, or ~ipad.
On disk, your image filenames may still include the #2x, -568h,
~iphone, or ~ipad modifiers as appropriate, although they are not
required. The system automatically accounts for such modifiers when
choosing which file to load.
UILaunchImageMinimumOSVersion - for iOS7 this should be a string “7.0”.
UILaunchImageOrientation – String containing one of: Portrait, PortraitUpsideDown, Landscape, LandscapeLeft, LandscapeRight.
UILaunchImageSize – String specifying width and height, ex: “{320, 480}”. You must specify the width and height with respect to
the device in a portrait orientation. In other words, portrait and
landscape images targeting the same device would have the same width
and height.
If this key is present, iOS 7 uses it exclusively to obtain launch
images.
BUT: I found that sticking to the naming convention also for iOS7 helped a lot!
This key is supported in iOS 7.0 and later.
OK – so now what?
Because I already had launch images for iOS6 and with all their specific naming conventions. I chose to make a copy of all of them and prefix the name with ”iOS7-” so as to limit my own confusion about all the different sizes and names. Making a prefix should prove to come in handy as then most of the images would immediately be loaded correctly.
The filenames:
I had these for iOS6 already, I also list the file sizes for those in need:
Default.png (320x480)
Default#2x.png (640x960)
Default#2x~ipad.png (2048x1496)
Default~ipad.png (768x1004)
Default1024x768.png (1024x768)
Default1024x768#2x.png (2048x1536)
Default-568h#2x.png (640x1136)
Default768x1024.png (768x1024)
Default768x1024#2x.png (1536x2048)
Default-Landscape~ipad.png (1024x748)
Default-Portrait#2x~ipad.png (1536x2048)
So I made a copy of all of these filenames for iOS7 (same sizes) prefixing them with "iOS7-":
iOS7-Default.png
iOS7-Default#2x.png
...
In XCode
Now to create your entry in PLIST. Go to your-name-of-application.plist. In a blank area, right-click and choose ”Add Row”. Make sure it becomes a top item and not a sub-item of some other information in the .plist.
Write:
UILaunchImages
Right-click on this UILaunchImages and select value type ”Array”.
Use the illustration below as a guide to the text and for how it will look when it is all finished:
If you open up this array so the little indicator triangle to the left points down, it is empty the first time, but if you choose ”add row” while it is open it will create a sub-line. Do that now:
Right-click on the UILaunchImages and select ”Add row”.
Right-click on this new line (item 0) and select value type ”Dict”
Continue opening this items with the triangle indicator and right-click and ”Add row”
This item you will name UILaunchImageMinimumOSVersion and set value type to “string” and the string to “7.0”
Now the following are all strings and should be at the same level as the UILaunchImageMinimumOSVersion item. In the same dict (dictionary). Create these by just choosing “Add row” for each:
UILaunchImageName – base-name-of-iOS7-launch-image. In my case this was ”iOS7-Default”
UILaunchImageOrientation - example: Portrait
UILaunchImageSize - the size of the elementary base iOS7-Default.png: "{320, 480}". The program will find all the files with permutations of the base name. Remember to select the base name of the file without ipad/iphone/portrait/landscape or .png specifications.
Note:
Xcode had already made the following items in the .plist for me after first adding iOS6 images in all available slots :-)
UILaunchImageFile~ipad … = ”Default” – so this was OK
UILaunchImages~ipad … Had two items that needed to be updated to iOS7 versions, because they where now incorrectly holding the iOS6 version. Those I had named Default1024x768 and Default768x1024 and now I just prefixed ”iOS7-” to each of the names and I was done.
Example of how it may look for those wanting to edit plist directly:
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>iOS7-Default </string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
</array>
[edit by jd: fixed spelling of "UILaunchImages"]
Highlight the project in the project browser, select "General", scroll down to "App Icons", click on "Use Asset Catalog", and select "Migrate". Your existing icons and splash screens will be automagically migrated into an asset catalog. You can then select the catalog to add further images.
To add new images you simply drag from Finder and drop into the squares for each image type.
(Caution: The catalog editor inexplicably uses a non-scrollable wide format, and you can be missing stuff off the right side if your screen isn't wide enough.)
You can also use the new image catalogue feature in Xcode 5 to manage multiple versions of launch images.
Now you can directly add the app icons and splash images in the images.xcassets,
Click on + button to add the respective image set for iphone5 with iOS 5,6,7 ,iphone4, iPad.
now no need to set the images name like default.png,default#2x.png
Be warned when using an images.xcassets repository it will not allow you to localize your splash screens.
I'm currently trying to get a French and English version of our app.
WWW> Will this 'plist' method work if you need to localize your splash screens?
I also had the same issue with an older app that I developed for iOS 7. It Archived and Uploaded fine with Xcode 6, but the "binary not optimized for iPhone5" error returned with Xcode 7. After trying a myriad of other solutions, I was only successful by removing all references to any Launch Image (since I was using a universal .xib) AND setting the deployment target from 7.0 to 8.0
I'm re-creating an AIR app with FB 4.5.1. (I've started from scratch, having had trouble importing FB 4 projects).
In the app.xml I have the following defined:
<systemChrome>none</systemChrome>
<transparent>true</transparent>
Having done this I still get a full window with titlebar, min, max, and close buttons.
what gives?
I believe you need to create a skin for the application.
This appears in Adobe's forum, and includes an FXP of a functional transparent app:
http://forums.adobe.com/thread/476699
Setting systemChrome & transparency along with "backgroundAlpha" to "0" would have helped in Flex 3.
But, skinning of components in Flex 4 i.e Spark components is little different and completely customizable.
Following are the steps you need to do make the window transparent.
Set systemChrome to "none" in the XML configuration file
Set transparent to "true" in the XML configuration file
Copy the skin code from <SDK_FOLDER>\frameworks\projects\airframework\src\spark\skins\spark\S parkChromeWindowedApplicationSkin.mxml and paste in a new MXML file.
Set the "alpha" property of "backgroundRect" object inside the skin file to "0".
Assign the newly created skin as the "skinClass" for "s:WindowedApplication" object
Please import the attached FXP file using "File->Import Flex Project" menu and have a look at the code to make it much more clear.
First, I discovered it is easier to interact with app.XML by opening it via "Open With -> Text Editor".
Second, and this is really embarrassing, I had simply failed to remove the comments bracketing
was:
<!-- <systemChrome>none</systemChrome> -->
<!--<transparent>true</transparent>-->
should have been:
<systemChrome>none</systemChrome>
<transparent>true</transparent>
...duh! I knew better, but...
Lastly, for a completely chromeless app, add
showStatusBar="false"
to the app header.
that's it!
I'm sure you've all seen this error before in your Titanium mobile projects. I've been getting it in an app I'm working on. It is usually thrown by the same type of operation, but not all the time and not in the same place. I'm wondering if anyone has found a solution to this issue yet.
The error is usually generated when I am iterating through an array of objects, and using that data to create views. Each new view is below its previous sibling, so the new view's top property looks something like this:
top = (from_top + old_view.height + 10);
As you can see I'm using the view.height property to figure out my top property, and I assume this is part of the problem. Anyone had any luck with this, or are you using a work around to avoid using a view's height property in addition?
(This is also posted on the Appcelerator Q&A site)
Why don't you use layout: 'vertical' instead of manually specifying the heights? It isn't in the docs at the moment, but as of 1.5 you can specify layout: 'vertical' on windows and scrollviews, possibly on views as well. Works on both iOS and Android.