Xamarin - Binary XML file line #1: Error inflating class <unknown> - c#

I am currently developing a small Android app in Xamarin, using C#.
The following shows up when I run it on my emulator:
This line of code is called when the first tab is selected, which is by default, meaning that this error occurs as soon as I run the program. The XML snippet which seems to be causing the error is this, in one of my layout files:
android:background="#color/done"
This is in line 111 of Dialer.axml, the entirety of which is below. Here, I am trying to reference a color state list for my button, so that the color changes depending on whether it is being touched or not. I know that this line causes the error, because removing it from the button tag which it's in causes the program to run perfectly. Here is the code for done.xml, in my color folder:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:color="#ff2222ff"/>
<item android:state_pressed="true" android:state_enabled="false" android:color="#ff4444ff"/>
<item android:state_enabled="false" android:color="#ff000000"/>
<item android:color="#ff0000ff"/>
</selector>
And here is the code for Dialer.axml:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/tableLayout1"
android:background="#2ec0ff">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:layout_marginBottom="40sp"
android:id="#+id/number"
android:editable="false"
android:singleLine="true"
android:scrollHorizontally="true"
android:gravity="right"
android:textColor="#fff" />
<TableRow
android:id="#+id/tableRow1"
android:layout_weight="1">
<Button
android:text="1"
android:layout_column="0"
android:id="#+id/button1"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="2"
android:layout_column="1"
android:id="#+id/button2"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="3"
android:layout_column="2"
android:id="#+id/button3"
android:layout_weight="1"
android:layout_height="match_parent" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_weight="1">
<Button
android:text="4"
android:layout_column="0"
android:id="#+id/button4"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="5"
android:layout_column="1"
android:id="#+id/button5"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="6"
android:layout_column="2"
android:id="#+id/button6"
android:layout_weight="1"
android:layout_height="match_parent" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_weight="1">
<Button
android:text="7"
android:layout_column="0"
android:id="#+id/button7"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="8"
android:layout_column="1"
android:id="#+id/button8"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="9"
android:layout_column="2"
android:id="#+id/button9"
android:layout_weight="1"
android:layout_height="match_parent" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_weight="1">
<Button
android:text="*"
android:layout_column="0"
android:id="#+id/buttonStar"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="0"
android:layout_column="1"
android:id="#+id/button0"
android:layout_weight="1"
android:layout_height="match_parent" />
<Button
android:text="#"
android:layout_column="2"
android:id="#+id/buttonPound"
android:layout_weight="1"
android:layout_height="match_parent" />
</TableRow>
<Button
android:text="Done"
android:id="#+id/buttonDone"
android:background="#color/done"
android:layout_width="match_parent"
android:layout_height="80sp"
android:textSize="35sp"
android:layout_margin="5sp" />
</TableLayout>
What is causing the error? Am I referencing done.xml incorrectly? Did I place it in the wrong folder?
Thanks in advance.

Your done.xml is color state list but color state lists can not be used as backgrounds. You need to use state-list-drawable for background.
Here is the state-list-drawable version of your color state list:
<?xml version="1.0" encoding="UTF-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="#ff2222ff" />
</shape>
</item>
<item android:state_pressed="true" android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="#ff4444ff" />
</shape>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="#ff000000" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="#ff0000ff" />
</shape>
</item>
</selector>
Put this into an xml file in your drawable file and make your layout button xml like this:
android:background="#drawable/done"
You can find similar question in this link:
How to set custom button state background color?

Related

How to create BottomNavigationView with xamarin for Android API 19

I tried to show a bottom navigation view on android phone with the API 19 with xamarin. It doesn't work. Can anyone tell me why it doesn't work?
My code is
Resources/layout/Main.xaml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:gridSpec="1|8|#0093eeff|K:#ee8700ff:16,l:72,l:16,r|S:#83ee00ff:16,0,l:16,56,l:16,0,r">
<!-- Header aligned to top -->
<RelativeLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/header_bg">
<!-- TODO Fill Dynamic, Format, Position-->
<TextView
android:id="#+id/prodCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="0 Artikel"
style="#style/TotalTxt"
android:layout_alignParentLeft="true" />
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
android:layout_alignParentBottom="true"
app:menu="#menu/navigation" />
</RelativeLayout>
</RelativeLayout>
Resources/menu/navigation.xaml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/navigation_home"
android:title="title_home" />
<item
android:id="#+id/navigation_dashboard"
android:title="title_dashboard" />
</menu>
The problem is I get a white screen on the smartphone. How can I fix the issue?
My problem is I can't install the dependency "com.android.support:design:25.1.0", because it don't match with the API 19. The API is to old.
You can change your project target android version for Android 7.0 (API 24) or higher, then you can download this android support design.
Please note: keep the target version consistent with the compiled version
I do one sample about creating BottomNavigationView with xamarin for Android.
1.download and install Xamarin.Android.Support.Design in Manage NuGet packageā€¦
2.create a new menu folder in the Resources directory and add a new .xml file, creating navigation_main.xml in Resources/menu/
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:orderInCategory="0"
android:id="#+id/menu_genres"
android:enabled="true"
android:title="Genres"
android:icon="#drawable/abc_ic_ab_back_material"
app:showAsAction="always" />
<item
android:orderInCategory="1"
android:id="#+id/menu_titles"
android:enabled="true"
android:title="Titles"
android:icon="#drawable/abc_ic_ab_back_material"
app:showAsAction="always" />
<item
android:orderInCategory="2"
android:id="#+id/menu_stream"
android:enabled="true"
android:title="Stream"
android:icon="#drawable/abc_ic_ab_back_material"
app:showAsAction="always" />
<item
android:orderInCategory="3"
android:id="#+id/menu_showtimes"
android:enabled="true"
android:title="Showtimes"
android:icon="#drawable/abc_ic_ab_back_material"
app:showAsAction="always" />
</menu>
3.Bottom navigation works by replacing fragments when one of the items is selected. This means that our Android xml should also have a FrameLayout to swap in and out the fragments that will be displayed.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/bottom_navigation" />
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="start"
android:layout_alignParentBottom="true"
android:background="#android:color/white"
app:menu="#menu/navigation_main" />
For more info, please take a look the following article:
https://blog.xamarin.com/exploring-androids-bottom-navigation-view/

Xamarin Android: Change the background color of a GridView item when clicked

I am searching how to change the background color of the clicked gridview item when it is clicked and then go back to normal color
I want that when I click, the background color of my gridview item is Orange and then after a short time, the background is white again.
Here is what I have found but "Device" is not known.
e.View.SetBackgroundColor(Color.White);
Device.StartTimer(TimeSpan.FromSeconds(0.25), () =>
{
e.View.SetBackgroundColor(Color.Orange);
return false;
});
I tried this :
1) Define Colors by creating colors.xml in values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="pressed_color">#972234</color>
<color name="default_color">#000000</color>
</resources>
2) Create bg_key.xml in drawable
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="#color/pressed_color"/>
<item
android:state_pressed="true"
android:drawable="#color/pressed_color"/>
<item
android:drawable="#color/default_color" />
</selector>
3) Set android:listSelector and listSelector to GridView
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:listSelector="#drawable/bg_key"
android:background="#color/default_color"
/>
And it is working on my side menu but not on my gridview... My grid view is composed by an ImageView and a TextView is it the problem?
Also, what should I change (for my side menu) to change the Font color and not the background color?
You can't use the Device-Class because it is only available in Xamarin.Forms and not native Xamarin.
But you can use the System.Timers.Timer class to change the color back after some time:
var t = new System.Timers.Timer();
t.Interval = 250; // In miliseconds
t.Elapsed += (sender, args) =>
{
// Change color back on the UI-Thread
RunOnUiThread(() =>
{
e.View.SetBackgroundColor(Color.Orange);
});
};
t.Start();
Important: The Elapsed-Event is NOT invoked on the UI-Thread. So to change something on the UI (just like your background color) you need to do this on the UI-Thread.
Device.StartTimer is used in Xamarin.Forms to start a recurring timer using the device clock capabilities. It's not available in native.
I prefer you can just make a custom style.
Try this :
1) Define Colors by creating colors.xml in values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="pressed_color">#972234</color>
<color name="default_color">#000000</color>
</resources>
2) Create bg_key.xml in drawable
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="#color/pressed_color"/>
<item
android:state_pressed="true"
android:drawable="#color/pressed_color"/>
<item
android:drawable="#color/default_color" />
</selector>
3) Set android:listSelector and listSelector to GridView
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:listSelector="#drawable/bg_key"
android:background="#color/default_color"
/>
Here is my code :
Main.axml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#EBEAEF">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:paddingLeft="5dp"
android:background="#282059"
android:title="test"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Dark" />
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!-- The Main Content View -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/logoBackgroud"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/icon_background" />
<GridView
android:id="#+id/grid_view_image_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="350dp"
android:layout_margin="10dp"
android:gravity="center"
android:numColumns="auto_fit" />
</RelativeLayout>
gridview.axml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EBEAEF">
<RelativeLayout
android:layout_height="90dp"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_margin="25dp"
android:listSelector="#drawable/bg_key"
android:background="#F4F4F6">
<!-- Letter yellow color = #FAB322 -->
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="95dp"
android:layout_height="fill_parent"
android:textSize="66sp"
android:textColor="#0071CF"
android:background="#color/white"
android:layout_centerVertical="true"
android:layout_gravity="left"
android:gravity="center_vertical|center_horizontal"
android:text="A"
android:paddingBottom="5dp"
android:id="#+id/textViewLetter" />
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:paddingLeft="15dp"
android:layout_toRightOf="#+id/textViewLetter"
android:layout_centerVertical="true"
android:layout_marginRight="35dp"
android:textSize="22sp"
android:gravity="center_vertical"
android:background="#F4F4F6"
android:textColor="#262057"
android:textStyle="bold"
android:listSelector="#drawable/bg_key"
android:id="#+id/textViewFileName" />
<ImageView
android:layout_width="35dp"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:layout_alignParentRight="true"
android:id="#+id/imageViewIcon" />
</RelativeLayout>
</LinearLayout>

Xamarin.Android Designer shows controls differently as they appear on my phone

I am unable to setup Xamarin.Android Designer pretty well. In my previous version of Windows and Visual Studio the Xamarin Default designer view looked Fine, but after upgrading to VS2015 and Win10, My Designer doesn't seem to be very well, As it's controls show differently on the designer and differently on my mobile phone. I am sharing two pictures of how it looks like on my phone and how it looks on Xamarin Designer.
In my Xamarin Designer:
In my Mobile Phone:
Please assist me regarding this issue, Thank you!
EDIT:
you won't be able to see the controls until you change their color if I choose the default theme of the designer.
Here it is how it looks when the default theme is selected
EDIT:
=> Here is my Main.axml file code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:weightSum="100"
android:minWidth="25px"
android:minHeight="25px"
android:layout_height="fill_parent">
<TextView
android:text="Create An Account"
android:id="#+id/tvCreateAccount"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_weight="20"
android:textColor="#368DEB"
android:gravity="center"
android:textStyle="bold"
android:textSize="25sp"
android:layout_width="match_parent"
android:layout_height="0dp" />
<Button
android:id="#+id/btnSignin"
android:text="Sign in"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="15"
android:background="#drawable/btnSignInStyle"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textSize="15sp" />
<TextView
android:text="Or"
android:id="#+id/tvOr"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="15"
android:textColor="#000000" />
<Button
android:id="#+id/btnSignup"
android:text="Sign Up with Email"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="15"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textSize="15sp" />
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="35"
android:minWidth="25px"
android:minHeight="25px">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
android:id="#+id/progressBar1" />
</RelativeLayout>
</LinearLayout>
=> Here is the xml File that I am assigning to btnSignin
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<layer-list>
<item android:right="2dp" android:top="5dp">
<shape>
<corners android:radius="2dp"/>
<solid android:color="#D6D6D6"/>
</shape>
</item>
<item android:bottom="2dp" android:left="2dp">
<shape>
<gradient android:angle="270" android:endColor="#4A6EA9" android:startColor="#4A6EA9"/>
<stroke android:width="1dp" android:color="#BABABA"/>
<corners android:radius="4dp"/>
<padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_pressed="true">
<layer-list>
<item android:right="2dp" android:top="5dp">
<shape>
<corners android:radius="2dp"/>
<solid android:color="#D6D6D6"/>
</shape>
</item>
<item android:bottom="2dp" android:left="2dp">
<shape>
<corners android:radius="4dp"/>
<gradient android:angle="270" android:endColor="#7C97C1" android:startColor="#4A6EA9"/>
<stroke android:width="1dp" android:color="#BABABA"/>
<padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/>
</shape>
</item>
</layer-list>
</item>
</selector>
After doing all sort of work arounds I finally Solved my Problem. What I did was downloaded the latest community version of Visual Studio 2015, and the Default Xamarin packages that were pre-installed in Visual Studio were not good for the health of my system. I just visited the Xamarin Site and downloaded the Xamarin components from there. and It installed other features plus the new Xamarin for VS2015, And now working it's fine on Xamarin Studio and on Visual Studio also!

Login to Facebook by Xamarin.Facebook.Android sdk

I want to login to Facebook using my Xamarin android app.
When I build my app it shows following error
com_facebook_device_auth_dialog_fragment.xml file is below
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content" card_view:cardBackgroundColor="#android:color/transparent"
card_view:cardElevation="10dp"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/com_facebook_auth_dialog_background"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="300dp"
android:layout_height="wrap_content"
android:background="#drawable/com_facebook_auth_dialog_header_background"
android:orientation="horizontal">
<FrameLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginBottom="11dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="11dp"
android:adjustViewBounds="false"
android:scaleType="fitXY" android:src="#drawable/com_facebook_favicon_white" />
</FrameLayout>
<TextView android:id="#+id/com_facebook_device_dialog_title" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="#string/com_facebook_loginview_log_in_button_long"
android:textColor="#color/com_facebook_share_button_text_color"
android:textSize="13sp" android:typeface="sans" />
</RelativeLayout>
<TextView android:id="#+id/com_facebook_device_auth_instructions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="28dp"
android:fontFamily="sans-serif-light"
android:gravity="center_horizontal"
android:singleLine="false" android:textColor="#color/com_facebook_device_auth_text"
android:textSize="14sp"
android:typeface="sans" />
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="14dp">
<TextView android:id="#+id/confirmation_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif-light"
android:textColor="#color/com_facebook_device_auth_text"
android:textSize="23sp"
android:typeface="sans"
android:visibility="invisible" />
<ProgressBar android:id="#+id/progress_bar"
style="#android:style/Widget.Holo.Light.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignBottom="#+id/confirmation_code"
android:layout_alignTop="#+id/confirmation_code"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="14dp"
android:layout_marginTop="17dp">
<Button android:id="#+id/cancel_button"
android:layout_width="84dp"
android:layout_height="27dp"
android:layout_gravity="center_horizontal"
android:background="#drawable/com_facebook_auth_dialog_cancel_background"
android:clickable="true"
android:focusable="true"
android:fontFamily="sans-serif-medium"
android:text="#android:string/cancel"
android:textAllCaps="true"
android:textColor="#color/com_facebook_device_auth_text"
android:textSize="10sp"
android:textStyle="bold"
android:typeface="sans" />
</FrameLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
I have provided the APP-ID in my string.xml file in this format
<string name="facebook_app_id">APP-ID</string>
My AndroidMainifest.xml file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="EcoFriend.EcoFriend" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="EcoFriend">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id" />
</application>
SDKs I have installed are
a) Xamarin.Facebook.Android by Xamarin.Inc. v 4.13.2
b)Xamarin.Android.Support.v4 by Xamarin.Inc v23.4.0.1
c)Xamarin.Android.Support.v7.CardView by Xamarin Inc. v23.4.0.1
d)Bolts by Xamarin.Inc v1.4.0
How to solve this problem?
Just change the:
card_view:cardBackgroundColor="#android:color/transparent"
card_view:cardElevation="10dp"
to:
app:cardBackgroundColor="#android:color/transparent"
app:cardElevation="10dp"
also add:
xmlns:app="http://schemas.android.com/apk/res-auto"
in
<android.support.v7.widget.CardView...
and you will be good to go.

missing the end of my app's screen

ok I am using a RelativeLayout, my problem is that when I run my app the bottom part of the screen is missing . here is the code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff457670">
<TextView
android:layout_width="163.3dp"
android:id="#+id/currentStreak"
android:layout_height="wrap_content"
android:text="Right:"
android:layout_marginTop="60dp"
android:background="#ff22202e"
android:textColorLink="#ffffffff"
android:textColor="#ffffffff" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#ffffff"
android:textStyle="bold"
android:textSize="50sp"
android:layout_marginTop="30dp"
android:id="#+id/number"
android:layout_marginLeft="130dp"
android:layout_marginRight="21.7dp" />
<TextView
android:layout_width="148.9dp"
android:layout_height="wrap_content"
android:text=" Wrong:"
android:layout_marginTop="60dp"
android:background="#ff22202e"
android:layout_alignParentRight="true"
android:textColor="#ffffffff"
android:id="#+id/Wrong" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#ffffff"
android:textStyle="bold"
android:textSize="50sp"
android:layout_marginTop="30dp"
android:id="#+id/number8"
android:layout_marginLeft="100dp"
android:layout_alignParentRight="true" />
<EditText
android:layout_width="332.2dp"
android:layout_height="61.9dp"
android:background="#f0000000"
android:textColor="#ffffff"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:textSize="30sp"
android:layout_marginTop="30dp"
android:id="#+id/Spinner"
android:layout_marginLeft="55.6dp"
android:layout_below="#+id/currentStreak" />
<EditText
android:layout_width="332.2dp"
android:layout_height="55.9dp"
android:layout_marginLeft="55.6dp"
android:background="#f0000000"
android:textColor="#ffffff"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:textSize="30sp"
android:layout_marginTop="10dp"
android:id="#+id/Spinner2"
android:layout_below="#id/Spinner"
android:visibility="invisible" />
<Button
android:id="#+id/EnterB"
android:layout_below="#+id/Spinner2"
android:layout_marginTop="30dp"
android:text="Enter"
android:layout_column="1"
android:layout_width="384.4dp"
android:layout_height="wrap_content"
android:background="#ff22202e"
android:enabled="false"
android:textColor="#ffffffff" />
<Button
android:id="#+id/myButton"
android:layout_marginTop="5dp"
android:text="Play a Note"
android:layout_column="1"
android:layout_width="384.5dp"
android:layout_height="53.5dp"
android:background="#ff22202e"
android:clickable="true"
android:layout_below="#id/EnterB" />
<TextView
android:layout_width="391.2dp"
android:id="#+id/blank"
android:layout_height="match_parent"
android:layout_marginTop="60dp"
android:background="#ff457670"
android:layout_below="#id/myButton"
android:textColor="#ffffffff" />
</RelativeLayout>
what am I doing wrong? I can see the whole screen in Xamarin Studio but not when I run the code... it shows the last button but then the screen is cut off. it so not show the last TextView
The relative layout needs to have the views laid out relative to others. It looks like everything is going to be stacked on top of each other in the upper left hand corner. You need to use these layout attributes in your XML layout so that things get positioned appropriately: http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html
Or if you just want them one on top of another, use the LinearLayout instead: http://developer.android.com/reference/android/widget/LinearLayout.html

Categories

Resources