私は古い質問(How to create standard Borderless buttons (like in the design guidline mentioned)?)の例のように私のボタンをスタイルする方法を探していますが、答えからいくつかのものが除外されています。スタイルを設定する方法
XML要素に複数の値、特にandroid:background ="";
を追加するにはどうすればよいですか?
私はボタンをボーダーレスにする方法を考え出しましたが、本当に細いボーダーと異なる背景色を持たせたいと思っています。私はオンラインでたくさんのヒントを見てきましたが、すべてのアイテムを適切にコードにまとめる方法を見つけることはできません。以下はコピー貼り付けイメージです。上の部分は、ボタン名とボタンの右側のサムネイル画像で達成したいレイアウトを表しています。ボタンの色はアプリのバックグラウンドと異なる場合があります私が達成しようとしているボーダースタイルのコピーペースト画像です。薄く、ボタンの境界線に触れています。私は私が必要とするどこにでも見て、多くのアイデアを試してみましたが、どれも正しく動作するように見えるん、または一部が
android:background="?android:attr/selectableItemBackground"
を持っている私を必要とするが、これは
android:background="#22272D"
と相互作用していますボタンのテキストをボタンのテキストをユーザーの電話の言語に翻訳するので、ボタン全体をボタンにすることはできません年齢。私のXMLと出力は以下の通りです。どのように変更しなければならないかについてのアドバイスは大いに役立つでしょう!
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="6"
tools:context="com.aid.travelers.myapplication.Transportation">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transportation_page"
android:textSize="40sp"
android:textColor="#000000"/>
<Button
android:layout_width="match_parent"
android:text="@string/airport"
android:id="@+id/AirportButton"
android:layout_height="60dp"
android:layout_weight="1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="?android:attr/selectableItemBackground"/>
<Button
android:layout_width="match_parent"
android:text="@string/bicycle"
android:id="@+id/BicycleButton"
android:layout_height="60dp"
android:layout_weight="1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="?android:attr/selectableItemBackground"/>
これは正確だったそうするために は、私はあなたが細い境界線が必要な場合はあなたにこのような何かをアドバイス完璧な、あなたの時間のためにそんなにありがとう、それは素晴らしい働いた! –