Please help me ,I convert the file PSD to Android xml file by exportkit ,Then came the mistakes
How do I remove these mistakes ?
and What is the reason for mistakes ?
[1]: http://i.stack.imgur.com/N3oDr.png
[2]: http://i.stack.imgur.com/rDyhn.png
[3]: http://i.stack.imgur.com/dZ0qc.png
<ImageView android:id="#+id/layer_2"
android:src="#drawable/layer_2"
android:contentDescription="#string/ek_img_content"
android:layout_marginStart="0dp"
android:layout_marginTop="219dp"
android:layout_width="550dp"
android:layout_height="398dp" />
<TextView android:id="#+id/first_app"
android:fontFamily="Tahoma"
android:layout_gravity="center_vertical|end"
android:gravity="end"
android:textSize="34sp"
android:textColor="#color/first_app_color"
android:layout_marginStart="164dp"
android:layout_marginTop="86dp"
android:layout_width="148dp"
android:layout_height="52dp"
android:text="#string/first_app_string"
/>
<TextView android:id="#+id/good_luck"
android:fontFamily="Tahoma"
android:layout_gravity="center_vertical|end"
android:gravity="end"
android:textSize="34sp"
android:textColor="#color/first_app_color"
android:layout_marginStart="142dp"
android:layout_marginTop="684dp"
android:layout_width="171dp"
android:layout_height="52dp"
android:text="#string/good_luck_string"
/>
</RelativeLayout>
</ScrollView>
</HorizontalScrollView>
Try this:
.xml file name should be small letters only allowed
Change: App1.xml to app.xml
Try Clean Project and Rebuilt your project.
Related
I'm getting a build error: 'failed linking file resources' in Android Studio. How do I solve this?
This is the problem:
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginBottom="75dp"
android:gravity="center"
android:textSize="400sp"
android:removeView=""
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
android:removeView doesn't exist. Remove that line.
there is some thing wrong in one of the XML files
you can go back and check your recently added/changed XML
for me it was spelling mistake(vible instead of visible)
<ProgressBar
android:id="#+id/prog_bar"
style="#style/ProgressBar.Green"
android:layout_width="0dp"
android:layout_height="20dp"
android:layout_weight="1"
**android:visibility="vible"**/>
public static final class id {
public static int Phone Number=0x7f050043;
error shows in a above link Phone Number=0x7f050043.
What could be the problem? I have already changed the XML id from #+id/Phone Number to #+id/phoneNumber.
I've done many things related with this like clean the project, delete gen folder, but the error persists. My project submission is tomorrow. Please help me find a Solution.
my XML file is
<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"
tools:context="com.example.pgfinder.Add_PG" >
<RelativeLayout
android:layout_width="400dp"
android:layout_height="470dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<EditText
android:id="#+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/house"
android:layout_below="#+id/house"
android:layout_marginTop="20dp"
android:ems="10"
android:gravity="center"
android:hint="Pg For Male or Female" />
<EditText
android:id="#+id/landmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/city"
android:layout_below="#+id/city"
android:layout_marginTop="17dp"
android:ems="10"
android:gravity="center"
android:hint="Landmark" />
<EditText
android:id="#+id/phone_number"
android:gravity="center"
android:hint="Phone Number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/landmark"
android:layout_below="#+id/landmark"
android:layout_marginTop="23dp"
android:ems="10" />
<EditText
android:id="#+id/house"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:ems="10"
android:gravity="center"
android:hint="House Address" />
<EditText
android:id="#+id/meal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/gender"
android:layout_below="#+id/gender"
android:layout_marginTop="25dp"
android:ems="10"
android:gravity="center"
android:hint="Pg With Meal or Not" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/meal"
android:layout_below="#+id/meal"
android:layout_marginTop="14dp"
android:ems="10"
android:gravity="center"
android:hint="City" />
<Button
android:id="#+id/add_pg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/Phone Number"
android:layout_below="#+id/Phone Number"
android:layout_marginTop="24dp"
android:text="Add New PG" />
<Button
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/add_pg"
android:layout_alignBottom="#+id/add_pg"
android:layout_alignRight="#+id/Phone Number"
android:text="Cancel" />
</RelativeLayout>
</RelativeLayout>
rename into
#+id/phoneNumber
save Ctrl s
try manual allocating by yourself in R.java
public static int phoneNumber=0x7f050050;
save ctrl s
Same thing happen to me , and i passed a day to fix this. really this is a stupid error. i am just shearing my experience, may be it would helpful to you . First look carefully when you type this setContentView(R.layout.activity_to_do_list); hear your starting point R.l then eclipse should open a suggestion for you look like this
you import the second one not layout-android.R . the second one is created in your project hear com.example.gridtest is the project package name . then focus your imported section in your code
ok look this import com.example.gridtest.R; its important . If you already import this android.R then remove it. Thank you hope it works . ( you don't need to do this always but if you face this kinda problem then do this )
There are more option you can try this click
Step 1: Delete build folder from project, and recompile your code. Recompilation will recreate build folder (and R file). It will solve the issue.
Step 2: If above step doesn't work rename id i.e. #+id/phoneNumber to #+id/phoneNumber1 and perform step 1 again.
Update
Replace each instance of Phone Number with phone_number like in
android:layout_below="#+id/Phone Number" or android:layout_alignLeft="#+id/Phone Number". Do it in both buttons i.e. add_pg and back.
See:
<Button
android:id="#+id/add_pg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/Phone Number"
android:layout_below="#+id/Phone Number"
android:layout_marginTop="24dp"
android:text="Add New PG" />
Replace it with :
<Button
android:id="#+id/add_pg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/phone_number"
android:layout_below="#+id/phone_number"
android:layout_marginTop="24dp"
android:text="Add New PG" />
I just started to learn app development and i don't know why this error is showing...can someone help..The error is showing in the both buttons.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Your total is 0"
android:textSize="45sp"
android:layout_gravity="center"
android:gravity="center"
android:id="#+id/tvDisplay"
/>
<Button
android:layout_width="250sp"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_length="wrap_content"
android:text="Add One"
android:id="#+id/bAdd"
/>
<Button
android:layout_width="250sp"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_length="wrap_content"
android:text="Subtract One"
android:id="#+id/bSub"
/>
</LinearLayout>
I see some issues in your layout resource.
If you want to give a specific width you should use dp instead of sp. The latter is meant for text. Check the documentation :)
Another thing that I think is not working is the "android:layout_length" property. I don't think this is a valid property. What did you want to achive with that?
I hope this will solve your problem.
I just created a new projet, building some layouts, writing some code. Everything was fine except I got this error as shown in the picture below.
I tried to remove and type it again and when typing 'R.id.', there was no 'container' showing up in the list. So that means theres no problem with my R file, just that the 'container' word lost somewhere.
Those code above are actually default code in onCreate() method in your main activity everytime you create a new project in Android Studio. (I actually tried to create a new project to compare and yes it's the same, and without error as it's brand new.).
All I did was comment out the if statement block so the error goes away, and the application has run just fine on the emulator. I just don't know why I got that problem and how I can handle it as I may need to do that in the future. Thank you!
Edit after #Raghunandan has mentioned: Below is my xml.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/provide_information"
android:id="#+id/provideInfoButton"
android:layout_alignParentTop="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/take_picture"
android:id="#+id/takePictureButton"
android:layout_below="#+id/provideInfoButton"
android:layout_alignParentLeft="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:layout_below="#+id/takePictureButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/classNameTextView"
android:layout_above="#+id/personNametextView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="44dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginBottom="38dp"
android:layout_above="#+id/emailTextView"
android:layout_alignLeft="#+id/emailTextView"
android:id="#+id/personNameTextView" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/emailTextView"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/classNameTextView"
android:layout_marginBottom="82dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/send_button"
android:id="#+id/sendButton"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
The reason is that I changed the root layout to RelativeLayout (the default of Android Studio was FrameLayout which has an id of "container"). My bad :). Thanks for mentioning about posting the xml file. I have not noticed that as I'm not as familiar with Android Studio as with Eclipse yet.
I m creating an app in that app i want to invisible this Mr. bla bla two line when i clicked on chat image.
any suggestion will be appriciate.
thanks in advance.
this is my xml file.
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/task_list_frag_list_message_layout"
android:background="#EBEBEB"
android:layout_marginBottom="10dp"
android:descendantFocusability ="blocksDescendants"
android:layout_marginTop="10dp"
android:layout_below="#+id/task_list_text"
android:layout_marginLeft="80dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/task_list_chat_persion1"
android:text="Mr. Test : "
android:textSize="18dp"
android:layout_marginTop="13dp"
android:textColor="#color/sky_blue_color"
/>
<TextView android:textColor="#color/black_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/task_list_chat_text1"
android:text="A send you a data file kindly get it."
android:textSize="18dp"
android:layout_marginTop="13dp"
android:layout_toRightOf="#+id/task_list_chat_persion1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/task_list_chat_persion2"
android:text="Mr. me : "
android:textSize="18dp"
android:layout_marginTop="13dp"
android:layout_below="#+id/task_list_chat_persion1"
android:textColor="#color/sky_blue_color"
/>
<TextView android:textColor="#color/black_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/task_list_chat_text2"
android:text="I got the data file and i have some doubt in them"
android:textSize="18dp"
android:layout_marginTop="13dp"
android:layout_below="#+id/task_list_chat_persion1"
android:layout_toRightOf="#+id/task_list_chat_persion2"
/>
</RelativeLayout>
this two lines are ij relative latout.
I think you want this ...
just need to add onClick() event on chat image and then on clicking set visibility of TextView to invisible by code.
TextView _text= (TextView)findViewById(R.id.task_list_chat_text);
_text.setVisibility(TextView.INVISIBLE);
When you click on chat button in the list view you should setTest="" blank for both remove it.
It may be solution of this problem.