I changed in eclipse background of layout and added new view (button).
I started my application but in emulator nothing changed!
What can I make? Mayby it's an Eclipse bug?
I downloaded this project from internet. Initially it had black background.
I added new View - all was OK.
But after I started changed background - and appeared this bugs
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/white"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<EditText
android:id="#+id/txtInd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ListView>
</LinearLayout>
Whenever you want to test the app again, DO NOT click on your app's icon in the emulator. However, select your project, and click on
IF this doesn't work. Try cleaning your project from : Project >>> Clean
Related
This question already has answers here:
Android studio 3.5 refactor issue
(9 answers)
Closed 3 years ago.
I created a simple layout file in android studio as below:
<?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="horizontal">
<EditText
android:id="#+id/NameEditText"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
when I press ALT+CTRL+L (Reformat) android studio changes my code to:
<?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="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/NameEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
as you may noticed, button's position has been changed from end to first and edittext's position changed from beginning of code to end of code!
could you please tell me is this behavior a bug or not? and if is not a bug, how can config android studio to behave normal?
File > Settings > Editor > Code Style > XML > Arrangement (tab) > Force rearrange => Never
I am trying to learn mvvmcross and I am a newbie now. I started to watch N + 1 days of MvvmCross video series and I am stuck at N = 2 Kittens and Lists. I add DownloadCashPlugin and FilePlugin to the project and create Mvx.MvxImageView as shown on the video but when I start my app(both simulator and android device), everything is same but images does not shown or not downloaded. I open permission from android manifest and I have an internet connection on my android device. I am pretty sure I follow videos carefully and dont miss any part.
I am using Visual Studio 2013 Communtiy Edition and MvvmCross is last updated version. I will be glad if anyone can help me on this problem. Thank you.
Item_Kitten.axml ;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Mvx.MvxImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_margin="10dp"
local:MvxBind="ImageUrl ImageUrl" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Text Name" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="30dp"
local:MvxBind="Text Price" />
</LinearLayout>
</LinearLayout>
When I run my android application in Android version >=4 I got this out put(I didn't tested in android version 3):
When run the same application in android version 2.3 I got a bit different output:
You can see in second screenshot the image for about button is not visible. But when I try run the same application several times on 2.3 some times I got about image visible.Here is my code :
<?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" >
<include layout="#layout/actionbar_with_right_button" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:drawablePadding="#dimen/settings_text_view_drawable_padding"
android:drawableTop="#drawable/snooze_button"
android:gravity="center"
android:onClick="showRemainderSnoozeSettings"
android:padding="#dimen/settings_text_view_padding"
android:text="#string/snooze" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:drawablePadding="#dimen/settings_text_view_drawable_padding"
android:drawableTop="#drawable/help_button"
android:gravity="center"
android:onClick="showFaq"
android:padding="#dimen/settings_text_view_padding"
android:text="#string/help" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:drawablePadding="#dimen/settings_text_view_drawable_padding"
android:drawableTop="#drawable/about_button"
android:gravity="center"
android:onClick="showAbout"
android:padding="#dimen/settings_text_view_padding"
android:text="#string/about" />
</LinearLayout>
</ScrollView>
I didn't understand why this is happening.
Can anyone help me to solve this issue.
Edit :
One more important thing I forgot to mention when I changed android:drawableTop="#drawable/about_button" to android:drawableTop="#drawable/help_button" of about TextView. It worked perfectly. So it can be an issue of my about_button image. So I recreated the about image again and put in all drawable folder. Even after that also I didn't get any +ve result. This issue only in 2.3 or less.
Thanks
May this help you:
Seems like this is a bug with android, where sometimes the first image in the drawable folder doesn't get displayed.....
I had a similar bug - a particular drawable was not being displayed, no matter in what ImageView. So I Added a dummy image called aaaa.png to the drawable folder and problem was solved....
Hi Everyone iam new to android and in my project requirement i need to create two LinearLayouts in same Position and they are animated later in the Java Code,For Testing Purpose initially i inserted image views on those layouts got succesfully after that i removed image views and Inserted EditTexts on the same layout but strange previous image is showing on one linear layout after executing which is not shown in preview
I tested all the options like cleaning the project ,uninstalling from device and reinstaling iam getting the same problem
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Animate Now"/>
<LinearLayout
android:id="#+id/image_list_fragment"
android:layout_width="250dip"
android:layout_below="#+id/button1"
android:layout_height="200dip"
android:background="#FF00FF"
android:layout_centerInParent="true"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Please Enter some text here"
android:singleLine="false"
/>
</LinearLayout>
<LinearLayout
android:layout_width="200dip"
android:layout_height="300dip"
android:orientation="vertical"
android:layout_below="#+id/button1"
android:visibility="visible"
android:background="#32FFFF"
android:layout_centerInParent="true"
android:id="#+id/image_details_fragment"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Please Enter some text here"
android:singleLine="true"
/>
</LinearLayout>
</RelativeLayout>
Here is the output the preview in Eclipse and output in Emulator After running
Please check your backend java file(activity class) once or paste it here. You might be setting an imageview with that background somewhere at runtime.
I have a crash (Application Stopped Unexpectedly) problem with this main.xml is a "HelloWorld" type project (while testing and learning features I need for my app) :
I isolated the ImageButton as an issue, but I can't isolate any of the parameters...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageButton android:id="#+id/picture"
android:layout_width="240dip"
android:layout_height="180dip"
android:layout_gravity="center_horizontal"
android:src="#drawable/icon"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:clickable="true"
android:scaleType="fitCenter" />
</LinearLayout>
icon.png exists in my resources...
I can see the preview in the Layout tab, even though the image is not centered on the button, but I read that it was normal.
The code below works fine (as a regular Button). I can also do the same as an ImageView.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button android:id="#+id/picture"
android:layout_width="240dip"
android:layout_height="180dip"
android:layout_gravity="center_horizontal" />
</LinearLayout>
I use Eclipse and the AVD, and all my learning is done on 2.1 (SDK level 7).
I can't test the app on an actual device yet as I don't have it yet.
Thanks in advance !
Oh bother !!
It seems that it was a java error in my MyApp.java, when I was trying to declare the event for the button. Case closed. Sorry.