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

Android Basic Tutorial : Get the Current Date and Time

Here’s a code snipped to get the current date and/or time. This snipped uses the Calendar object (java.util.Calendar) which is a useful class when working with dates.






//Get a calendar object for the current date and time Calendar CurrentDateTime = Calendar.getInstance();
//Example: Get current day of the month

Android Basic Tutorial : Circular Seek Bar

public class Welcome extends Activity {     CircularSeekBar circularSeekbar;
    @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         circularSeekbar = new CircularSeekBar(this);         circularSeekbar.setMaxProgress(100);         circularSeekbar.setProgress(100);         setContentView(circularSeekbar);         circularSeekbar.invalidate();
        circularSeekbar.setSeekBarChangeListener(new OnSeekChangeListener() {
            @Override             public void onProgressChange(CircularSeekBar view, int newProgress) {                 Log.d("Welcome", "Progress:" + view.getProgress() + "/" + view.getMaxProgress());             }         });
    } }