Skip to main content

How to create Slanted TextView in Android | Android Studio | Stackoverflow

Android Slanted TextView .


Preview

预览

Gradle

compile 'com.haozhang.libary:android-slanted-textview:1.1'


XML Layout

<com.haozhang.lib.SlantedTextView
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:gravity="center"
    app:slantedBackgroundColor="@color/secondary_text"
    app:slantedLength="40dp"
    app:slantedMode="left"
    app:slantedText="IOS"
    app:slantedTextColor="@color/primary"
    app:slantedTextSize="16sp"
    />


Java


    SlantedTextView stv = (SlantedTextView) findViewById(R.id.test);

    stv.setText("PHP")
            .setTextColor(Color.WHITE)
            .setSlantedBackgroundColor(Color.BLACK)
            .setTextSize(18)
            .setSlantedLength(50)
            .setMode(SlantedTextView.MODE_LEFT);


Attributes

注意

SlantedMode
SlantedMode

License
Copyright 2016 Hand HaoZhang

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Comments

Popular posts from this blog

Raised Button : Material Design Tips

From google material design documentation.
A typically rectangular material button that lifts and displays ink reactions on press. How to add? I. In your build.gradle add latest appcompat library. dependencies { compile 'com.android.support:appcompat-v7:X.X.X'// where X.X.X version} II. Make your activity extend android.support.v7.app.AppCompatActivity. publicclassMainActivityextendsAppCompatActivity{...} III. Declare your Button inside any layout.xml file <Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Button"/> How to style?
I. Declare custom style in your styles.xml file.

Floating Labels : Material Design Tips

From google material design documentation. When the user engages with the text input field, the floating inline labels move to float above the field. How to add? I. In your build.gradle add latest appcompat and design libraries. dependencies { compile 'com.android.support:appcompat-v7:X.X.X'// where X.X.X version compile 'com.android.support:design:X.X.X'// where X.X.X version} II. Make your activity extend android.support.v7.app.AppCompatActivity. publicclassMainActivityextendsAppCompatActivity{...} III. Declare your EditText inside any layout.xml file and wrap it with TextInputLayout. <android.support.design.widget.TextInputLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="@string/Title"/></android.support.design.widget.TextInputLayout>

Switch : Material Design Tips

From google material design documentation.
On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.
The on/off slide toggle with the text “on” and “off” included within the asset is deprecated. Use the switch shown here instead. How to add? I. In your build.gradle add latest appcompat library. dependencies { compile 'com.android.support:appcompat-v7:X.X.X'// where X.X.X version} II. Make your activity extend android.support.v7.app.AppCompatActivity. publicclassMainActivityextendsAppCompatActivity{...} III. Declare your SwitchCompat inside any layout.xml file <android.support.v7.widget.SwitchCompatandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:checked="true"/> SwitchCompat is a backward compatible version of the Switc…