Generate R.Java and Layout - Intellij vs Eclipse - java

please look at this main.xml -
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/TableLayout03">
In eclipse its coming out fine, no errors and project is working
In Intellij its stopping my project from generating a R.java class file and if I undo the main.xml to the default, R.java is present and its marking red a host of resource reference.e.g R.layout.main, R.id.myWebSite
What am I doing wrong?

<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
İ think you should remove id part.

Related

R cannot be resolved to a variable (different scenario)

Firstly, I have searched and seen similar questions on Stackoverflow however I'm building outside Android studio or Eclipse so mine is a bit different and I'm looking for a solution or alternative if possible.
I am building a plugin that sends messages between Java and Javascript using Cordova.
I have 3 lines to resolve:
setContentView(R.layout.main);
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);
Specifically just the setContentView(R.layout.main), findViewById(R.id.preview) and findViewById(R.id.faceOverlay). The layout file is in ../../../res/layout/main.xml and ../../../res/layout-land/main.xml.
All I want is a way to access, I do not have a R.java file and I'm not very experienced with Java unlike Javascript.
Is there a way to point to those files please, thanks.
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/topLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<com.cordovaplugincamerapreview
android:id="#+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.cordovaplugincamerapreview
android:id="#+id/faceOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.cordovaplugincamerapreview>
</LinearLayout>

Custom UI library not working in project

I have added a library in my project. However, when I use any of the views provided by the library, it gives me unbound prefix error. I have added the namespace as well in my xml file, still I am getting this error.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:wingokuFlatUI="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.wingoku.flatUI.WinGokuFlatButton
android:id="#+id/wingoku3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="wingoku"
android:textColor="#fff"
wingokuFlatUI:normalStateColor="#EB974E"
wingokuFlatUI:pressedStateColor="#F2784B" />
</RelativeLayout>
UPDATE:
After making some changes, now I am getting this error
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'normalStateColor' in package
'com.example.android_flatui_testing'
- error: No resource identifier found for attribute 'pressedStateColor' in package
'com.example.android_flatui_testing'
What changes can I make to the code in order to get rid of this error?
Regards
The namespace you are defining is flatUI and you are using flatui later. I think you should be using the same character casing in both the instances.
I found this website for this before...
they implemented an example for adding the xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:wingokuFlatButton="http://schemas.android.com/apk/res/com.wingoku.flatUI"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

Android Textview is not showing full typeface of hindi text

xml file
<?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:background="#color/holo_blue_green"
android:orientation="vertical" >
<TextView
android:id="#+id/tv_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="none"
android:text="………यांच्या मते १८५७ चा उठाव म्हणजे “भारतीयाचे पहिले स्वातंत्रयुद्ध ” होय ."
android:textColor="#android:color/black"
android:textStyle="bold" />
</LinearLayout>
भारतीयाचे - this word is not full.
Change encoding to "windows-1250"
Try to add your text dynamically or you just paste your text in the eclipse text editor and check how the look is showing in that view after it's showing the same view What you have mentioned as above image..You will Do the below steps
Step 1: Paste your TTf file in the Assets folder and belowed the name Fonts/Verdana.ttf
Step 2: And use your fonts dynamically...like below
TextView myTextView=(TextView)findViewById(R.id.textBox);
Typeface typeFace=Typeface.createFromAsset(getAssets(),"fonts/mytruetypefont.ttf");
myTextView.setTypeface(typeFace);
All the best

UI doesnt render when i use Navigation Drawer in my android app

i want to use Navigation Drawer in my app. according google documentation here, i write my UI code like this:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
MAIN LAYOUT IS HERE
</FrameLayout>
<!-- The navigation drawer -->
<ListView android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
this is like google's own example but it gives me an error in layout preview:
Exception raised during rendering: DrawerLayout must be measured with MeasureSpec.EXACTLY.
i searched a lot about it, some people says that you have to put explicit values for android:layout_width and android:layout_height. when i do this everything is going to be OK but i dont want to put explicit values! because i dont know every device width and height... how i can fix that? whats the solution?
i already put android-support-v4.jar file in lib folder. i think its the latest version.
just right click on project >> select android tool >> select add support library .
this should work , just do same steps !

Android ScrollView not working

I have a layout which I want to be scrollable when content is overflowing the screen.
I have the following layout xml set up.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="#+id/ScrlView"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:isScrollContainer="false"
android:id="#+id/home_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/backrepeat">
<!-- Include Header -->
<include layout="#layout/main_header"/>
<!-- Include dashboard -->
<include layout="#layout/dashboard"/>
</LinearLayout>
</ScrollView>
A dashboard is a collection of icons serving as a menu. Example: click me
Unfortunately, the second include (dashboard) shows 'broken' now. See screen:
Click here
As you can see it doesn't look like it's suposed to. When I delete the scrollview, everything is fine.
What I want is for my dashboard to still look good, but be scrollable if needed.
I tried several setups but all give the same result. What am I doing wrong?
Any help would be appreciated :)
Remove the android:isScrollContainer="false", and add android:fillViewport="true" to scrollView

Categories