0

次のような非常に基本的なレイアウトがあります。状況を表すためだけに、ImageView で赤い背景を使用しています。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_bg_grey_stroke_radius"
android:orientation="vertical" >

<ImageView
    android:id="@+id/IV"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_alignParentLeft="true"
    android:background="#ff0000" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text"
    android:layout_toRightOf="@+id/IV" />

</RelativeLayout>

これは私が使用しているカスタム背景です:

custom_bg_grey_stroke_radius.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- background color of the entire rectangle -->
<solid android:color="#FFFFFF" />

 <!-- color of borders -->
<stroke
    android:width="1dp"
    android:color="#c1c1c1" />

   <corners
    android:bottomLeftRadius="4dp"
    android:bottomRightRadius="4dp"
    android:topLeftRadius="4dp"
    android:topRightRadius="4dp" />

</shape>

画像を円形にするさまざまなリンクを見つけましたが、4 つのコーナーすべてからのものです。このリンクは、画像を上または下から円形にする方法を示しています。 Androidはレイアウトの背景画像を丸め、上隅または下隅のみ

誰かが画像を左から円形にする方法を見つけてください。正確な半径を指定できればよいのですが。私はそれを5dp前後でかろうじて円形にしたい。

そして、繰り返して申し訳ありませんが、私はこれを解決することができません.

4

0 に答える 0