1. 程式人生 > >Android ConstraintLayout 兩控制元件部分相疊相容佈局

Android ConstraintLayout 兩控制元件部分相疊相容佈局

ConstraintLayout  佈局時有時候經常會有一些控制元件之間重疊的設計,直接設定距某一位置距離相容性太差

我目前想到的是再重疊控制元件上放一個透明控制元件另一個根據他佈局即可

示例:

LinearLayout疊在RecyclerView下方TextView是透明控制元件
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:
tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/transparent" tools:context="com.kelvins.bilin.MainActivity"><android.support.v7.widget.RecyclerView android:id="@+id/recyclerBanner"
android:layout_width="0dp" android:layout_height="0dp" android:background="@color/transparent" app:layout_constraintDimensionRatio="H,10:4.4" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent"> </android.support.v7.widget.RecyclerView> <TextView android
:id="@+id/tv_top" android:layout_width="0dp" android:layout_height="0dp" android:background="@color/transparent" app:layout_constraintDimensionRatio="H,10:4.05" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <LinearLayout android:id="@+id/linearLayout" android:layout_width="wrap_content" android:layout_height="0dp" android:alpha="0.99" android:background="@mipmap/icon_background" android:gravity="center" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toBottomOf="@+id/tv_top" app:layout_constraintVertical_bias="0.934">

相關推薦

Android ConstraintLayout 控制元件部分相容佈局

ConstraintLayout  佈局時有時候經常會有一些控制元件之間重疊的設計,直接設定距某一位置距離相容性太差 我目前想到的是再重疊控制元件上放一個透明控制元件另一個根據他佈局即可 示例: Li

Android之switch控制元件字型style

<style name="switch_text_true_blue"> <item name="android:textColor">#3346da</item> </style> <style name="

Android之switch控制元件監聽

mSwith.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(Comp

Android之switch控制元件佈局

<Switch android:track="@drawable/switch_track" android:thumb="@drawable/swith_thumb" android:id="@+id/zx_switch"

Android listview子控制元件的的點選事件(轉)

1.先看圖,是否是你想要的   2.佈局檔案<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" androi

android-自定義控制元件

自定義控制元件兩種方式 1、繼承ViewGroup 例如:ViewGroup , LinearLayout, FrameLayout, RelativeLayout等。 2、繼承View 例如:View, TextView, ImageView, Button等。 View的測量

Android 自定義控制元件-星級評分

在學習自定義控制元件時需要一些例子來練練手,本文這個控制元件就是在這種環境下產生的(可能有BUG); 這個控制元件設計的特點: 1,可以任意修改星星數量 2,可以星星大小會隨控制元件大小而縮小,在控制元件足夠大的情況可以任意設定星星大小 3,滑動監聽,根據滑動距離選擇星級 4,可

Android------------UI的控制元件學習內容

1. android:gravity="fill_horizontal"  :  文字在顯示框中內容顯示的位置 2.ToggleButton :  切換按鈕   3.RadioGroup :  單選按鈕 4.CheckBox :

Android設定常見控制元件點選效果

一. Imageview的點選效果——圖片稍微變暗突出點選效果 public class ClickImageView extends AppCompatImageView { public ClickImageView(Context context) { super(context);

[Android自定義控制元件] Android自定義控制元件

轉載自: http://blog.163.com/[email protected]/blog/static/103242241201382210910473/ 開發自定義控制元件的步驟: 1、瞭解View的工作原理  2、

Android 自定義控制元件釋義

由於經常在android的開發過過程中與控制元件打交道,所以有些android控制元件並不能滿足我們的需求, 進而需要自定義一 些為我們所用,但是本文只是一些名詞解析,具體實現可以網路搜尋獲得答案,在此只是個人的筆錄 1:自定義控制元件方式: 1.1:繼承view,button,

Android自定義控制元件】炫酷的底部導航欄

https://github.com/WakeHao/NavBar 基本使用 使用這個控制元件,只需要簡單的幾部 引入該控制元件到你的專案中 compile 'com.chen.wakehao.library:bottom-navigation-bar:1.0.0'

Android自定義控制元件之區域性圖片放大鏡--BiggerView

零、前言: 本文的知識點一覽 1.自定義控制元件及自定義屬性的寫法,你也將對onMesure有更深的認識 2.關於bitmap的簡單處理,及canvas區域裁剪 3.本文會實現兩個自定義控制元件:FitImageView(圖片自適應)和BiggerView(放大鏡),前者為後者作為鋪墊。 4.最後會

Android入門——基本控制元件詳解

Android應用開發的一項重要內容就是介面開發。對於使用者來說,不管APP包含的邏輯多麼複雜,功能多麼強大,如果沒有提供友好的圖形互動介面,將很難吸引終端使用者。作為一個程式設計師如何才能開發出友好的圖形介面呢。實際上Android提供了非常豐富UI(User Interface)控制元

Android 側滑控制元件DrawableLayout與Toolbar結合使用+NavigationView

側拉布局 <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/a

Android學習(十)—— Android自定義控制元件

Android自定義控制元件 安卓在使用中大多數使用已有的一些控制元件,用法比較簡單,還有一部分是比較複雜的、使用者自己想的控制元件,這些就需要進行自定義控制元件,今天就來簡單說一下自定義控制元件。 1、繪製過程 建立一個類,繼承View類 onMeasure()方法,測量計算檢視的大小

Android——(高階控制元件ListView)

1. BaseAdapter:是所有介面卡類的父類,可以對列表項進行最大限度的定製   1.1 自定義介面卡中的方法       getCount       getView       getIte

Android——(高階控制元件下拉框與搜尋框)

1. 高階控制元件與低階控制元件區別    是否使用介面卡 2. 介面卡種類和作用   2.1 種類       陣列介面卡 ArrayAdapter         new ArrayAdapt

Android的高階控制元件

高階控制元件與低階控制元件區別 是否使用介面卡 介面卡種類和作用 2.1 種類 陣列介面卡 ArrayAdapter new ArrayAdapter(this,R.layout.actv_style, names); 簡單介面卡 SimpleAdapter 也叫“並不簡

Android自定義控制元件-不同形狀的ImageView

實現分析: 依然是用到Paint的圖層混合模式, 1、畫一個你想要的形狀 || 圖片 2、修改Paint的圖層混合模式,畫圖片。 3、然後就能得到你想要的形狀的ImageView paint.setXfermode(new PorterDuffXfermode(Mode