これは私がアンドロイドで実装したい画像です。androidのこの種のレイアウトを実装する方法
のxmlレイアウトを設計するために、あなたがあなたをリサイクラービューを横にスクロールするだけでなく、画像をスクロールしたい場合は
これは私がアンドロイドで実装したい画像です。androidのこの種のレイアウトを実装する方法
のxmlレイアウトを設計するために、あなたがあなたをリサイクラービューを横にスクロールするだけでなく、画像をスクロールしたい場合は
このコード:RoundedImageView
については
<com.xxx.xxx.xxx.RoundedImageView
android:id="@+id/imageView_round"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:scaleType="fitCenter"
android:src="@drawable/doctor" />
あなたがこれをコピー&ペーストする必要があります。
public class RoundedImageView extends ImageView {
public RoundedImageView(Context context) {
super(context);
}
public RoundedImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
Drawable drawable = getDrawable();
if (drawable == null) {
return;
}
if (getWidth() == 0 || getHeight() == 0) {
return;
}
Bitmap b = ((BitmapDrawable) drawable).getBitmap();
Bitmap bitmap = b.copy(Bitmap.Config.ARGB_8888, true);
int w = getWidth(), h = getHeight();
Bitmap bmm = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth(),
bitmap.getHeight(), true);
Bitmap roundBitmap = getCroppedBitmap(bitmap, w);
canvas.drawBitmap(roundBitmap, 0, 0, null);
}
public static Bitmap getCroppedBitmap(Bitmap bmp, int radius) {
Bitmap sbmp;
if (bmp.getWidth() != radius || bmp.getHeight() != radius)
sbmp = Bitmap.createScaledBitmap(bmp, radius, radius, false);
else
sbmp = bmp;
Bitmap output = Bitmap.createBitmap(sbmp.getWidth(), sbmp.getHeight(),
Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xffa19774;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, sbmp.getWidth(), sbmp.getHeight());
paint.setAnti`enter code here`Alias(true);
paint.setFilterBitmap(true);
paint.setDither(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(Color.parseColor("#BAB399"));
canvas.drawCircle(sbmp.getWidth()/2 + 0.7f,
sbmp.getHeight()/2 + 0.7f, sbmp.getWidth()/2 + 0.1f, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(sbmp, rect, rect, paint);
return output;
}
}
私はこれが
これはリサイクラービューで実装することが可能で何がどうあるべきか私を助けてください以下のコードを使用することができます。
あなたは、水平レイアウトに(画像付)と のTextView(共有値194を持つ)を リサイクラービューを追加することができ、我々はリストにスクロールしたら、あなたはTextViewの中でカウント保留中の要素を設定することができますrecyclerView.setLayoutManager(new LinearLayoutManager(RecyclerView_Activity.this, LinearLayoutManager.HORIZONTAL, false));
。
画像をスクロールしない場合は、線形レイアウトで画像を追加し、テキストビューを追加してカウントを表示するだけです。あなたの.xmlページの使用では
使用サークル画像ビューを助け、 'ことを願っています線形レイアウト(Linear Layout)は水平である。 –