EditText boxes look differently onFocus event - java

Hi I have a couple of EditText boxes in a GridLayout. However, the code for the EditText is exactly the same. But they look different onFocus event. Any idea why this is occurring?
The texboxes after each one of them were selected:
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:alignmentMode="alignBounds"
android:columnCount="3"
android:columnOrderPreserved="false"
android:useDefaultMargins="true">
<TextView
android:id="#+id/tvDisinfectionContact"
style="#style/formsubsubheader"
android:layout_width="250dp"
android:layout_columnSpan="3"
android:layout_gravity="fill_horizontal"
android:paddingTop="10dp"
android:text="#string/disinfection_contact" />
<TextView
android:layout_width="300dp"
android:layout_columnSpan="1"
android:gravity="start"
android:visibility="gone" />
<TextView
android:id="#+id/tvPpmUnit"
style="#style/fieldlabel"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_columnSpan="1"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="#string/unit_ppm" />
<TextView
android:id="#+id/tvMinutesUnits"
style="#style/fieldlabel"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_columnSpan="1"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="#string/unit_mins" />
<TextView
android:id="#+id/tvLvlCheAdd"
style="#style/fieldlabel"
android:layout_width="250dp"
android:layout_columnSpan="1"
android:gravity="start"
android:labelFor="#+id/etLvlCheAddPpm"
android:paddingTop="12dp"
android:text="#string/lvl_cheaddition" />
<EditText
android:id="#+id/etLvlCheAddPpm"
android:width="100dp"
android:layout_columnSpan="1"
android:layout_gravity="center_horizontal"
android:ems="16"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:maxLength="50"/>
<EditText
android:id="#+id/etLvlCheAddMinutes"
android:layout_columnSpan="1"
android:layout_gravity="center_horizontal"
android:width="100dp"
android:ems="16"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:maxLength="50" />
<TextView
android:id="#+id/tvLvlFlushADD"
style="#style/fieldlabel"
android:layout_width="250dp"
android:layout_columnSpan="1"
android:gravity="start"
android:labelFor="#+id/etLvlFlushAddPpm"
android:paddingTop="12dp"
android:text="#string/lvl_flushddition" />
<EditText
android:id="#+id/etLvlFlushAddPpm"
android:width="100dp"
android:layout_columnSpan="1"
android:layout_gravity="center_horizontal"
android:ems="16"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:maxLength="50" />
<EditText
android:id="#+id/etLvlFlushMinutes"
android:layout_columnSpan="1"
android:layout_gravity="center_horizontal"
android:width="100dp"
android:ems="16"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:maxLength="50" />
</GridLayout>

On Android O there has been some Input and Navigation Changes . You won't see the changes in the View on different android versions. You can check if your app is running on O, and if so call setDefaultFocusHighlightEnabled(false) on the EditText view.
This sets whether this View should use a default focus highlight when it gets focused but doesn't have R.attr.state_focused defined in its background.

Related

How to fill a full line in a vertical LinearLayout

This is my first app so sorry I know its not that good. My english neither.
I got a problem with my xml design: I want 2 Buttons and 2 TextViews in one line and to fill the whole line. At the moment it looks like that:
but it gets even worse:
My code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="-" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="#+id/button11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="+" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="-" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="#+id/button12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="+" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="-" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="#+id/button13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="+" />
</LinearLayout>
<!--
skipping additional rows of identical structure
-->
</LinearLayout>
The problem is that you use wrap_content on the children of the linear layout. there are 2 solutions to your problem one is to use match parent on the text views and add gravity centre to them like this:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="-" />
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="centre"
android:text="TextView" />
<TextView
android:id="#+id/textView13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="centre"
android:text="TextView" />
<Button
android:id="#+id/button13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="+" />
</LinearLayout>
And another solution is to use a constraint layout with allows you to spread the child views using chains.
If I understood correctly, you should try for each of your LinearLayout :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="4" // number of sub items
>
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="-" />
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
<TextView
android:id="#+id/textView11"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
<Button
android:id="#+id/button11"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="+" />
Also, you should take a look at RecyclerViews and create your own adapter and rows. It will be much easier to deal with.

Keyboard pushing admob advertisment up

I have an android application. I just added the sample advertisments to my app, and I keep having problems with the ad over my EditText.
When I click on the EditText, the advertisment which is at the bottom of the screen moves up above the keyboard.
My code is below:
<?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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context="org.alexwebber.frc.strongholdcalculator.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/autonomous"
android:textSize="25sp"
android:textStyle="bold"
android:layout_alignParentStart="true"
android:id="#+id/autoLabel" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:id="#+id/autogrid"
android:layout_below="#+id/autoLabel"
android:layout_alignParentStart="true"
android:layout_marginTop="1dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/defreached"
android:id="#+id/defenseReached"
android:textSize="17sp"
android:layout_row="0"
android:layout_column="0"
android:layout_columnSpan="13" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/defcrossed"
android:textSize="17sp"
android:id="#+id/defcrossed"
android:layout_row="1"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/lowgoal"
android:textSize="17sp"
android:id="#+id/lowgoalauto"
android:layout_row="2"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/highgoal"
android:textSize="17sp"
android:id="#+id/highgoalauto"
android:layout_row="3"
android:layout_column="0" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/autodefreach"
android:textSize="12sp"
android:layout_row="0"
android:layout_column="24"
android:enabled="true"
android:text="#string/total" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/autodefcross"
android:textSize="12sp"
android:enabled="true"
android:text="#string/total"
android:layout_row="1"
android:layout_column="24" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/autolowgoal"
android:enabled="true"
android:text="#string/total"
android:textSize="12sp"
android:layout_row="2"
android:layout_column="24" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/autohighgoal"
android:textSize="12sp"
android:text="#string/total"
android:enabled="true"
android:layout_row="3"
android:layout_column="24" />
</GridLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/teleop"
android:id="#+id/teleopLabel"
android:layout_below="#+id/autogrid"
android:textSize="25sp"
android:textStyle="bold"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_marginTop="0dp" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="175dp"
android:layout_below="#+id/teleopLabel"
android:layout_alignParentStart="true"
android:layout_marginTop="1dp"
android:id="#+id/gridLayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/defcrossed"
android:id="#+id/defcrossedtele"
android:textSize="17sp"
android:layout_row="0"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/lowgoal"
android:id="#+id/lowgoaltele"
android:textSize="17sp"
android:layout_row="1"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/highgoal"
android:id="#+id/highgoaltele"
android:textSize="17sp"
android:layout_row="2"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/challegedTower"
android:id="#+id/challengestower"
android:textSize="17sp"
android:layout_row="3"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/scaledTower"
android:id="#+id/scaledtowertele"
android:textSize="17sp"
android:layout_row="4"
android:layout_column="0" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/teledefcross"
android:text="#string/total"
android:enabled="true"
android:layout_row="0"
android:textSize="12sp"
android:layout_column="13" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/telelowgoal"
android:text="#string/total"
android:enabled="true"
android:layout_row="1"
android:textSize="12sp"
android:layout_column="13" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/telehighgoal"
android:text="#string/total"
android:enabled="true"
android:layout_row="2"
android:textSize="12sp"
android:layout_column="13" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/telechallengedtower"
android:text="#string/total"
android:enabled="true"
android:layout_row="3"
android:textSize="12sp"
android:layout_column="13" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/telescaledtower"
android:text="#string/total"
android:enabled="true"
android:layout_row="4"
android:textSize="12sp"
android:layout_column="13" />
</GridLayout>
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/gridLayout"
android:id="#+id/rpgrid">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/breach"
android:id="#+id/breach"
android:layout_marginTop="1dp"
android:checked="false"
android:layout_row="0"
android:layout_column="0"
android:layout_below="#+id/gridLayout"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/capture"
android:id="#+id/captured"
android:layout_marginTop="1dp"
android:checked="false"
android:layout_row="0"
android:layout_column="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/calculate"
android:id="#+id/button"
android:textSize="20sp"
android:layout_row="1"
android:layout_column="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/totalscore"
android:textSize="20sp"
android:id="#+id/total"
android:layout_row="1"
android:layout_column="1"
android:layout_gravity="right" />
</GridLayout>
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:windowSoftInputMode="adjustPan"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
It moves up and overlaps EditText because you set alignParentBottom="true", thus when keyboard shows up, the layout parent bottom is the top of the SoftKeyboard.
You should probably get the solution by adding the all content above the AdView and by calling adjustResize on the Activity declaration in Manifest. On a side note, I'm not sure that calling android:windowSoftInputMode="adjustPan" in AdView xml's widget is going to do something...
Therefore, to handle this behaviour, put the AdView at the top of layout's container and declare a sub-container for the rest of content:
<RelativeLayout ...>
<AdView
android:id="#+id/adView"
android:layout_alignParentBottom="true"
... />
<RelativeLayout
android:layout_above="#id/adView"
...>
<TextView ...>
<GridLayout ...>
<GridLayout ...>
</RelativeLayout>
</RelativeLayout>
Then, make the layout adjusting when keyboard shows up in Manifest.xml:
<activity
android:windowSoftInputMode="adjustResize"
... />
This should work as expected on similar answer. Also, there is another workaround: dynamically detect when the Keyboard is showing up and make the AdView invisible, and vice versa, but I think it does too much hard code than resolved into layout.
Have you set adjustResize for windowSoftInputMode in your Manifest file? this will cause your UI layout to resize when the input method popup. if you don't want to resize, remove it.
<activity
android:name=".TestActivity"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden"
android:label="#string/app_name" >
</activity>
http://developer.android.com/training/keyboard-input/visibility.html#Respond

Put Image View above Button - Android

I have some XML that looks like this
<!--
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/divider"
android:layout_centerHorizontal="true"
android:background="#ffffff"
android:minWidth="2dp"
android:layout_below="#+id/emailField" />
-->
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:id="#+id/Btn1"
android:background="#907F0106"
android:layout_below="#+id/emailField"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:id="#+id/Btn2"
android:background="#907F0106"
android:textColor="#ffffff"
android:layout_below="#+id/emailField"
android:layout_alignRight="#+id/emailField"
android:layout_alignEnd="#+id/emailField" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/divider"
android:layout_centerHorizontal="true"
android:background="#ffffff"
android:minWidth="2dp"
android:layout_below="#+id/emailField" />
I have tried it above and below but it always looks like it is partly hidden behind the buttons, as seen below
But I want a full white line going down, not one that is partly hidden behind?
Try using view instead of ImageView
<View
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="#+id/relativeLayout"
android:background="#color/yourDesiredColor" />

Displaying more than one image on Android App

I have created an Android App that contains 10 TextView boxes and I have given each one a different background. When I run the app on my device, it crashes, if I use 10 different backgrounds. If I use only 8 different backgrounds to fill up the 10 TextView boxes, the app works fine. Why does this happen and how can I fix it?
EDIT:
Sorry for not adding code, but below is the xml file. Notice I add a background to each TextView from img1 to img10. If I load this on my device, the program will crash. If I changed img9 to img7 and img10 to img7, then it will work fine. I cannot figure out why this occurs and I checked the sizes. They do not add up to 16MB.
So, excuse my ignorance. I am new to android app creating, but I found that a OutOfMemory exception is being thrown. This does not make size, b/c my images are all under 100 KB.
<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="#8ad0e8"
tools:context=".Adamantium1" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:background="#drawable/img1"
android:textStyle="bold"
android:text="9" />
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img2"
android:text="9" />
<TextView
android:id="#+id/textView3"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img3"
android:layout_weight="1"
android:text="9" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_below="#+id/linearLayout1"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp" >
<TextView
android:id="#+id/textView4"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img4"
android:layout_weight="1"
android:text="9" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img5"
android:text="9" />
<TextView
android:id="#+id/textView6"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img6"
android:text="9" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout2"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp" >
<TextView
android:id="#+id/textView7"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img7"
android:text="9" />
<TextView
android:id="#+id/textView8"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img8"
android:text="9" />
<TextView
android:id="#+id/textView9"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="60sp"
android:textStyle="bold"
android:background="#drawable/img9"
android:text="7" />
</LinearLayout>
<EditText
android:id="#+id/editText1"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_below="#+id/textView10"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:ems="1"
android:inputType="numberPassword" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView10"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_below="#+id/linearLayout3"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="9"
android:textSize="60sp"
android:background="#drawable/img10"
android:textStyle="bold" />
<Button
android:id="#+id/EnterPass"
style="?android:attr/buttonStyleSmall"
android:layout_width="90dp"
android:layout_height="40dp"
android:layout_alignBottom="#+id/editText1"
android:layout_marginLeft="21dp"
android:layout_toRightOf="#+id/editText1"
android:text="Enter" />
</RelativeLayout>
May be your images are too large to be held in the heap of per application in android which is 16 MB in 4.2 .
Possible solution is decrease your image size.
This is the best I can tell from your problem posted here.

Exception raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error Log

suddenly eclipse started to give that error.
"Exception raised during rendering: Circular dependencies cannot exist in RelativeLayout
Exception details are logged in Window > Show View > Error Log"
This is my xml file.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:context=".Generate" >
<View
android:id="#+id/view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/generatetv1"
android:layout_alignTop="#+id/generatetv1"
android:layout_centerHorizontal="true"
android:background="#90000000" />
<View
android:id="#+id/view1"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_alignBottom="#+id/generate_dukkan"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/generate_direnisci_adi"
android:background="#drawable/extension" />
<Button
android:id="#+id/generatebtn3"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="20dp"
android:background="#drawable/button"
android:text="Buradan Git" />
<Button
android:id="#+id/generatebtn2"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_above="#+id/generatebtn1"
android:layout_marginBottom="4dp"
android:background="#drawable/button"
android:text="Button2" />
<Button
android:id="#+id/generatebtn1"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_above="#+id/generatebtn3"
android:layout_marginBottom="16dp"
android:background="#drawable/button"
android:text="generate_dukkan" />
<TextView
android:id="#+id/generate_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/generatetv1"
android:text="DigitalClock"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<TextView
android:id="#+id/generatetv1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/generatebtn2"
android:layout_below="#+id/generate_puan"
android:textColor="#FFFFFF"
android:layout_marginTop="80dp"
android:text="#string/hello_world"
android:textSize="20dp" />
<TextView
android:id="#+id/generate_puantext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/generate_seviye"
android:layout_alignBottom="#+id/generate_seviye"
android:layout_alignLeft="#+id/generate_time"
android:text="Puan "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/generate_puan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/generate_seviye"
android:layout_alignBottom="#+id/generate_seviye"
android:layout_alignRight="#+id/generate_time"
android:layout_toRightOf="#+id/generate_puantext"
android:background="#242424"
android:gravity="right"
android:text="200"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/generate_seviye"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/generatetv1"
android:layout_alignRight="#+id/destekimg"
android:layout_marginBottom="2dp"
android:layout_toRightOf="#+id/generate_seviyetext"
android:background="#242424"
android:gravity="right"
android:text="0"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/generate_direnisci_adi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/generate_seviye"
android:layout_alignLeft="#+id/generate_seviye"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/generate_time"
android:text="Direnisci Adi"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/maskeimg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/view1"
android:layout_alignLeft="#+id/generate_seviye"
android:layout_alignTop="#+id/eldivenimg"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:adjustViewBounds="true"
android:background="#drawable/text_field"
android:src="#android:drawable/spinner_background" />
<ImageView
android:id="#+id/eldivenimg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/view1"
android:layout_alignTop="#+id/generate_dukkan"
android:layout_marginRight="5dp"
android:layout_toRightOf="#+id/maskeimg"
android:adjustViewBounds="true"
android:background="#drawable/text_field"
android:src="#android:drawable/spinner_background" />
<ImageView
android:id="#+id/destekimg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/view1"
android:layout_alignTop="#+id/eldivenimg"
android:layout_toRightOf="#+id/eldivenimg"
android:adjustViewBounds="true"
android:background="#drawable/text_field"
android:src="#android:drawable/spinner_background" />
<TextView
android:id="#+id/generate_seviyetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/view1"
android:layout_below="#+id/generate_time"
android:layout_marginTop="10dp"
android:text="SevÄ°ye "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<Button
android:id="#+id/generate_dukkan"
style="?android:attr/buttonStyleSmall"
android:layout_width="80dp"
android:layout_height="30dp"
android:layout_alignRight="#+id/generate_time"
android:layout_below="#+id/generate_puan"
android:background="#drawable/dukkan_img"
android:layout_marginTop="5dp"
android:scaleType="centerCrop" />
what can I do to fix this?
The problem is caused because there is a circular reference is the layout parameters.
For example when view B is layout_below View A, view A can't reference view B anymore in it's below, alignRight etc. This can also exist between multiple views: A references B references C. In that scenario C can't reference A because of a circular dependency.
You'll need to evaluate the references again. Does it give you a line number?
Edit:
When I remove these 2 from android:id="#+id/generate_seviye" it works:
android:layout_above="#+id/generatetv1"
android:layout_alignRight="#+id/destekimg"
But you probable need to do some fixing of the layout and check the references.
#+id/view2 has:
android:layout_alignBottom="#+id/generatetv1"
android:layout_alignTop="#+id/generatetv1"
Which seems wrong to me.
I know you should use as little layouts as possible, but adding one linearlayout will probably make it a lot easier

Categories

Resources