欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

如何使用Android實(shí)現(xiàn)圖片一邊的三角形邊框效果-創(chuàng)新互聯(lián)

這篇文章將為大家詳細(xì)講解有關(guān)如何使用Android實(shí)現(xiàn)圖片一邊的三角形邊框效果,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

成都創(chuàng)新互聯(lián)是一家從事企業(yè)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站、行業(yè)門(mén)戶網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)制作的專業(yè)的建站公司,擁有經(jīng)驗(yàn)豐富的網(wǎng)站建設(shè)工程師和網(wǎng)頁(yè)設(shè)計(jì)人員,具備各種規(guī)模與類(lèi)型網(wǎng)站建設(shè)的實(shí)力,在網(wǎng)站建設(shè)領(lǐng)域樹(shù)立了自己獨(dú)特的設(shè)計(jì)風(fēng)格。自公司成立以來(lái)曾獨(dú)立設(shè)計(jì)制作的站點(diǎn)上千家。

在真實(shí)的APP當(dāng)中,我們還會(huì)加上一個(gè)SrcollView控件,這樣子才可以進(jìn)行不斷地上下瀏覽。我們這里主要是為了讓大家明白這個(gè)視圖是該如何實(shí)現(xiàn)的,就不演示SrcollView控件下的做法了,直接在線性布局下做一個(gè)簡(jiǎn)單的說(shuō)明。由于在線性布局上面一共具有四張圖,因此咱們可以先單獨(dú)編寫(xiě)每一個(gè)imageview的自定義view,然后<include>的語(yǔ)法將他們組合起來(lái),這樣可以提高UI開(kāi)發(fā)的效率,進(jìn)行協(xié)同工作與開(kāi)發(fā)。首先咱們先實(shí)現(xiàn)左上角和右上角的triangle view.

在build.gradle文件當(dāng)中相應(yīng)地方添加如下代碼,導(dǎo)入相應(yīng)的maven庫(kù):

allprojects {    repositories {      ...      maven { url "https://jitpack.io" }    }}

之后在另一個(gè)build.gradle文件當(dāng)中添加庫(kù):

dependencies {      implementation 'com.github.shts:TriangleLabelView:1.1.2'  }

咱們的前期工作就這樣做好啦,現(xiàn)在就開(kāi)始正式編寫(xiě)咱們的每一個(gè)三角形邊框視圖啦,首先是第一個(gè)位于左上角的視圖

一.card_left_top.xml:

<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent">  <RelativeLayout    android:layout_width="match_parent"    android:layout_height="match_parent">    <ImageView      android:id="@+id/image"      android:scaleType="centerCrop"      android:src="@drawable/s_image_2"      android:layout_width="match_parent"      android:layout_height="match_parent" />    <jp.shts.android.library.TriangleLabelView      android:layout_width="match_parent"      android:layout_height="match_parent"      android:layout_alignParentLeft="true"      android:layout_alignParentTop="true"      app:backgroundColor="@color/yellow_900"      app:corner="leftTop"      app:labelBottomPadding="5dp"      app:labelCenterPadding="0dp"      app:labelTopPadding="10dp"      app:primaryText="New"      app:primaryTextColor="@color/yellow_500"      app:primaryTextSize="16sp"      app:secondaryText="01"      app:secondaryTextColor="@color/yellow_100"      app:secondaryTextSize="11sp" />  </RelativeLayout></android.support.v7.widget.CardView>

編寫(xiě)好后在preview當(dāng)中顯示如下:

下面是位于右上角的視圖

二.card_right_top.xml:

<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent">  <RelativeLayout    android:layout_width="match_parent"    android:layout_height="match_parent">    <ImageView      android:id="@+id/image"      android:scaleType="centerCrop"      android:src="@drawable/s_image_4"      android:layout_width="match_parent"      android:layout_height="match_parent" />    <jp.shts.android.library.TriangleLabelView      android:layout_width="match_parent"      android:layout_height="match_parent"      android:layout_alignParentRight="true"      android:layout_alignParentTop="true"      app:backgroundColor="@color/teal_900"      app:corner="rightTop"      app:labelBottomPadding="5dp"      app:labelCenterPadding="0dp"      app:labelTopPadding="10dp"      app:primaryText="New"      app:primaryTextColor="@color/teal_500"      app:primaryTextSize="16sp"      app:secondaryText="01"      app:secondaryTextColor="@color/teal_100"      app:secondaryTextSize="11sp" />  </RelativeLayout></android.support.v7.widget.CardView>

三.card_right_buttom.xml:

<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent">  <RelativeLayout    android:layout_width="match_parent"    android:layout_height="match_parent">    <ImageView      android:id="@+id/image"      android:scaleType="centerCrop"      android:src="@drawable/s_image_3"      android:layout_width="match_parent"      android:layout_height="match_parent" />    <jp.shts.android.library.TriangleLabelView      android:layout_width="match_parent"      android:layout_height="match_parent"      android:layout_alignParentRight="true"      android:layout_alignParentBottom="true"      app:backgroundColor="@color/pink_900"      app:corner="rightBottom"      app:labelTopPadding="10dp"      app:labelCenterPadding="5dp"      app:labelBottomPadding="0dp"      app:primaryText="New"      app:primaryTextColor="@color/pink_500"      app:primaryTextSize="16sp"      app:secondaryText="01"      app:secondaryTextColor="@color/pink_100"      app:secondaryTextSize="11sp" />  </RelativeLayout></android.support.v7.widget.CardView>

四.card_left_buttom.xml:

<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent">  <RelativeLayout    android:layout_width="match_parent"    android:layout_height="match_parent">    <ImageView      android:id="@+id/image"      android:src="@drawable/s_image_1"      android:scaleType="centerCrop"      android:layout_width="match_parent"      android:layout_height="match_parent" />    <jp.shts.android.library.TriangleLabelView      android:layout_width="match_parent"      android:layout_height="match_parent"      android:layout_alignParentLeft="true"      android:layout_alignParentBottom="true"      app:backgroundColor="@color/blue_900"      app:corner="leftBottom"      app:labelTopPadding="10dp"      app:labelCenterPadding="5dp"      app:labelBottomPadding="0dp"      app:primaryText="New"      app:primaryTextColor="@color/blue_500"      app:primaryTextSize="16sp"      app:secondaryText="01"      app:secondaryTextColor="@color/blue_100"      app:secondaryTextSize="11sp" />  </RelativeLayout>

最后咱們整合一下就OK啦!整合后的主活動(dòng)的代碼為:

五.activity_main.xml:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:tools="http://schemas.android.com/tools"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:orientation="vertical"  tools:context=".Fragment2"> <LinearLayout    android:layout_width="match_parent"    android:layout_height="0dp"    android:layout_weight="1"    android:orientation="horizontal">    <include android:layout_width="0dp"      android:layout_height="match_parent"      android:layout_weight="1"      android:layout_margin="2dp"      android:id="@+id/left_top" layout="@layout/card_left_top" />    <include android:layout_width="0dp"      android:layout_height="match_parent"      android:layout_weight="1"      android:layout_margin="2dp"      android:id="@+id/right_top" layout="@layout/card_right_top" />  </LinearLayout>  <LinearLayout    android:layout_width="match_parent"    android:layout_height="0dp"    android:layout_weight="1"    android:orientation="horizontal">    <include android:layout_width="0dp"      android:layout_height="match_parent"      android:layout_weight="1"      android:layout_margin="2dp"      android:id="@+id/left_bottom" layout="@layout/card_left_bottom" />    <include android:layout_width="0dp"      android:layout_height="match_parent"      android:layout_weight="1"      android:layout_margin="2dp"      android:id="@+id/right_bottom" layout="@layout/card_right_bottom" />  </LinearLayout></LinearLayout>

關(guān)于“如何使用Android實(shí)現(xiàn)圖片一邊的三角形邊框效果”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

分享名稱:如何使用Android實(shí)現(xiàn)圖片一邊的三角形邊框效果-創(chuàng)新互聯(lián)
鏈接地址:http://aaarwkj.com/article18/iedgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)自適應(yīng)網(wǎng)站、電子商務(wù)、外貿(mào)網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)、標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司
国产我和子的乱视频亲生| 久久精品免成人费电影| 日韩电影一区二区在线观看中文字幕| 中文字幕人妻久久精品一区| 人妻少妇被猛烈进入中文字幕91| 国产精品呦呦国产精品尤物 | 激情欧美一区二区三区精品| 国产老太婆精品久久久久| 最新日韩欧美不卡一二三区| 91亚洲国产成人精品性色| 久久这里只有精品伊人网| 亚洲av毛片免费在线| 亚洲熟女少妇淫语高潮| 国产av不卡精品影片| 国产日产精品一区二区三区四区| 人妻少妇中文字幕在线播放| 欧美在线观看日韩精品| 一区二区三区亚洲精品在线| 国产精品男人在线播放| 精品爆白浆一区二区三区| 亚洲综合一区二区精品久久| 极品大胸美女被啪啪的高潮| 日韩视频专区一区二区| 精品人妻一区二区三区观看| 91观看免费完整版高清| 成人激情电影免费在线| 中文字幕久久av一区二区| 综合久久精品亚洲天堂| 欧美亚洲尤物久久精品| 日本91大神在线观看| av天堂在线观看网站| 91成人精品永久在线观看| 午夜福利尤物一区二区| 丰满少妇诱惑在线观看| 国产成人免费自拍一区| 午夜视频在线观看免费版| 亚洲乱码一区二区在线| 亚洲综合av伊人久久| 日韩亚洲人成网站在线播放| av在线亚洲网站区一| 亚洲一区欧美二区日韩|