Androidは、WeChatチャット入力ボックス機能を使用しています。
LayerDrawable
各- は一つのDrawableを表します。item>は、left、right、top、bottomで左右上下のオフセット量を設定できます。
WeChatを実現するチャット入力ボックスを真似します。
まず緑の背景を設定します。
白を重ねて、側面の緑の線の高さを残します。
もう一つの白を敷いて、もうセットした背景を覆って、底と側面の線を残して、中間の層は実は両側の緑の線枠の高さを残すためです。
以上は小编で绍介したAndroidが<layer-list>を使って微信チャットの入力ボックスを実现しました。皆さんに助けを求めています。ここでも私たちのサイトを応援してくれてありがとうございます。
<layer-list>
タグはLayerDrawableを設置しています。階層的なDrawableの重ね合わせ効果があります。各
WeChatを実現するチャット入力ボックスを真似します。
まず緑の背景を設定します。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_green_light" />
</shape>
</item>
</layer-list>
白を重ねて、側面の緑の線の高さを残します。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_green_light" />
</shape>
</item>
<item android:bottom="8dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
もう一つの白を敷いて、もうセットした背景を覆って、底と側面の線を残して、中間の層は実は両側の緑の線枠の高さを残すためです。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_green_light" />
</shape>
</item>
<item android:bottom="8dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
<item
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:shape="rectangle">
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
以上は小编で绍介したAndroidが<layer-list>を使って微信チャットの入力ボックスを実现しました。皆さんに助けを求めています。ここでも私たちのサイトを応援してくれてありがとうございます。