イメージボタンを円形にしてサークルの内側にイメージを作成する方法を探しています表示されます。しかし、私は何か役立つ情報源を見つけることができませんでした。私はわずか24時間しか持っていません。私のクライアントはそれをチェックします。イメージボタンを円形にする方法、イメージが表示され、イメージの周りに境界線が表示されます
私の目的はイメージボタン(黒い色の円、下の図を参照してください)とイメージを作成することです。ここで
私のXMLの一部である...のImageButtonがここに
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/backg" android:orientation="vertical" android:weightSum="10" tools:context="sudhirpradhan.example.com.clientpptapp.mainIconFragment"> <LinearLayout android:layout_width="match_parent" android:orientation="vertical" android:layout_height="0dp" android:layout_weight="5" /> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:orientation="horizontal" android:layout_weight="4.5"> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <!--here is my imageButton need to be look like a circle and within that circle ,a picture will be shown .............. --> <ImageButton android:id="@+id/imageButton" android:layout_width="0dp" android:padding="10dp" android:scaleType="fitCenter" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_weight="3" android:background="@drawable/roundbutton" android:src="@drawable/frontbutton" /> <!-- ..........................................................--> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:orientation="vertical" android:layout_height="0dp" android:layout_weight="0.5" /> </LinearLayout>
2つのコメント行との間にあるroundbutton /描画可能なXML @
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#50d050"
android:endColor="#008000"
android:angle="270"/>
<stroke android:width="5px"
android:color="#000000"/>
</shape>
です:下の画像を参照してください。
どのように実装することができますか。何か提案していただきありがとうございます。
画像ボタン内に正方形/長方形の画像を実装するためのソースコードのリンク.. –
投稿を編集しました。それがあなたが必要とする結果であるかどうか見てください。 – alexscmar
この画像はちょうどボタンの上に置かれています。パディング= 5pxを使用すると、画像はサークルを隠し、サークルから出てきます。必要なのは画像ですサークルから外れるべきではありません。詰め物がない場合はいつも好きです....ありがとうございます –