Android Studio Development/Design Tricks

Button with border

<Button
                android:id="@+id/email_sign_in_button"
                style="?android:textAppearanceSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="17dp"
                android:background="@drawable/btn_accented_cornered"
                android:paddingLeft="50dp"
                android:paddingRight="50dp"
                android:text="@string/login"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                app:layout_constraintEnd_toEndOf="@+id/textInputLayout4"
                app:layout_constraintStart_toStartOf="@+id/textInputLayout4"
                app:layout_constraintTop_toBottomOf="@+id/textInputLayout4" />

//btn_accented_cornered.xml

<?xml version="1.0" encoding="UTF-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="50dp" />
    <solid android:color="@color/colorPrimary" />
    <stroke
        android:width="1dip"
        android:color="@color/colorPrimary" />
</shape>



TextEdit with grey background

<EditText
                    android:id="@+id/password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/spinner_bg"
                    android:hint="@string/prompt_password"
                    android:imeActionId="6"
                    android:imeActionLabel="@string/action_sign_in_short"
                    android:imeOptions="actionUnspecified"
                    android:inputType="textPassword"
                    android:maxLines="1"
                    android:singleLine="true" />


//spinner bg

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <layer-list>
            <item>
                <shape>
                    <gradient android:angle="90" android:endColor="#eee" android:startColor="#eee" android:type="linear" />
                    <corners android:radius="5dp" />
                    <padding android:bottom="10dp" android:left="3dp" android:right="3dp" android:top="10dp" />
                </shape>
            </item>
        </layer-list>
    </item>
</selector>

Spinner with theme

<Spinner
                android:id="@+id/sp_option"
                style="@style/Spinner2Theme"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/txt_to"
                android:layout_marginTop="10dp"
                android:visibility="gone" />

//style Spinner2Theme

<!-- TextEdit WITH GREY BACKGROUND AND BORDER RADIUS (FOR DIALOG) -->
    <style name="TextEdit2Theme" parent="AppTheme">
        <item name="android:background">@drawable/spinner_bg</item>
    </style>


//drawable/spinner_bg

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <layer-list>
            <item>
                <shape>
                    <gradient android:angle="90" android:endColor="#eee" android:startColor="#eee" android:type="linear" />
                    <corners android:radius="5dp" />
                    <padding android:bottom="10dp" android:left="3dp" android:right="3dp" android:top="10dp" />
                </shape>
            </item>
        </layer-list>
    </item>
</selector>

Comments

Popular posts from this blog

Android/Java: Crear un SplashScreen para nuestra aplicación

Android/Java: Video de fondo en nuestro Login

Android/Kotlin: Video de fondo en nuestro Login