Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Rendering problems on Android Studio #11

Closed
ernes87lp opened this issue May 7, 2014 · 4 comments
Closed

Rendering problems on Android Studio #11

ernes87lp opened this issue May 7, 2014 · 4 comments

Comments

@ernes87lp
Copy link

Hi, I'm having this issue on Android Studio, I don't know how to fix it. It's weird because I did a test a month ago and everything worked fine. I'm using the API 19. I'm trying to add a simpel edit text. Also, if I run the app on the emulator, the control is not rendered properly.

Here's a screenshot of the error.

rendering

And here's the layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:flatui="http://schemas.android.com/apk/res-auto"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:background="@color/background">

<com.cengalabs.flatui.views.FlatTextView
        android:id="@+id/etUsername"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dip"
        android:layout_marginLeft="5dip"
        android:maxLines="1"
        android:gravity="center_vertical"
        android:text="Edit Texts"
        flatui:textColor="main"
        flatui:theme="@array/candy"/>
</RelativeLayout>

Thanks in advance

@u3amar
Copy link

u3amar commented May 9, 2014

I'm also getting this error in Eclipse.

@u3amar
Copy link

u3amar commented May 10, 2014

I was able to fix this problem by editing the Attributes class. I changed the setThemeSilent and setTheme methods and added a method:

public void setTheme(int theme, Resources resources)
{
    this.theme = theme;

    try
    {
        colors = resources.getIntArray(theme);
    }
    catch (NotFoundException e)
    {
        checkNullColors();
    }

    attributeChangeListener.onThemeChange();
}

public void setThemeSilent(int customTheme, Resources resources)
{
    this.theme = customTheme;

    try
    {
        colors = resources.getIntArray(customTheme);
    }
    catch (NotFoundException e)
    {
        checkNullColors();
    }
}

private void checkNullColors()
{
    if (colors == null)
    {
        colors = new int[4];
        colors[0] = Color.parseColor("#ad843d");
        colors[1] = Color.parseColor("#d4a14a");
        colors[2] = Color.parseColor("#fbbf58");
        colors[3] = Color.parseColor("#fae8c8");
    }
}

When viewing the UI through the UI builder, Eclipse isn't able to find the request integer array using the resources, so it throws a NotFoundException. Whenever this happens, we make sure the colors are being set using the default color scheme for the sand theme. This is not an ideal solution because it means we can't view other themes in the UI builder, but it does allow us to edit the positions of elements on screen.

@eluleci
Copy link
Owner

eluleci commented May 29, 2014

I fixed this issue but didn't update the repository yet. Thanks @u3amar for suggestion. I'll close the issue and comment when the repo is updated.

@eluleci
Copy link
Owner

eluleci commented May 30, 2014

This issue is fixed with version 2.0.1

@eluleci eluleci closed this as completed May 30, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants