navasmdc / MaterialDesignLibrary

This is a library with components of Android L to you use in android 2.2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Color selector dialog

Ishwor-Shrestha opened this issue · comments

The color selector dialog does not show all the contents if viewed in small screen, but works in big screen phones.

Same problem with me too.

I had the same problem. I fix this problem changing onCreat method like this:
...
colorView.post(new Runnable() {
@OverRide
public void run() {
/*
LinearLayout.LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.width =
params.height = colorView.getWidth()/2;
colorView.setLayoutParams(params);
/
}
});
...
*

And change color_selector layout to:

<LinearLayout
    android:id="@+id/contentSelector"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    android:background="@drawable/dialog_background"
    android:orientation="vertical">

    <View
        android:id="@+id/viewColor"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="50"
        android:background="#FFFFFF"
        android:orientation="vertical"
        android:padding="16dp"/>

    <LinearLayout
        android:id="@+id/llRGB"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_gravity="center"
        android:layout_weight="50"
        android:background="#FFF"
        android:gravity="center"
        android:orientation="vertical"
        android:padding="10dp">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="33"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:text="R"
                android:textColor="#4D4D4D"
                android:textSize="17sp" />

            <com.gc.materialdesign.views.Slider
                android:id="@+id/red"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#4D4D4D"
                materialdesign:max="255"
                materialdesign:min="0"
                materialdesign:showNumberIndicator="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="33"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:text="G"
                android:textColor="#4D4D4D"
                android:textSize="17sp" />

            <com.gc.materialdesign.views.Slider
                android:id="@+id/green"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#4D4D4D"
                materialdesign:max="255"
                materialdesign:min="0"
                materialdesign:showNumberIndicator="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="33"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:text="B"
                android:textColor="#4D4D4D"
                android:textSize="17sp" />

            <com.gc.materialdesign.views.Slider
                android:id="@+id/blue"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#4D4D4D"
                materialdesign:max="255"
                materialdesign:min="0"
                materialdesign:showNumberIndicator="true" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>