我可以将圆形应用于以下代码..? [英] Can I apply rounded shape to the following code..?

查看:54
本文介绍了我可以将圆形应用于以下代码..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

collage_item_one.xml

collage_item_one.xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android">
    android:id="@+id/rel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">
    <com.cgfx.photo.cgspecialfx.widget.photosortrview>
        android:id="@+id/photoSortrViewOne"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <ImageView

        android:id="@+id/ivOne"

        android:layout_width="50dp"

        android:layout_height="50dp"

        android:layout_centerInParent="true"

        android:src="@drawable/addnewpic"/>
</com.cgfx.photo.cgspecialfx.widget.photosortrview>
</relativelayout>











one.xml






one.xml

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

    android:id="@+id/rlScreenShot"

    android:layout_width="match_parent"

    android:layout_height="match_parent" >

    <LinearLayout

        android:id="@+id/llBackground"

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:layout_centerInParent="true"

        android:removed="@android:color/transparent"

        android:orientation="vertical" >
        <include

            android:id="@+id/view1"

            layout="@layout/college_item_one" />
    </LinearLayout>

</RelativeLayout>




main.xml





main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:whatever="http://schemas.android.com/apk/res-auto"

    xmlns:widget="http://schemas.android.com/apk/res-auto"

    xmlns:ads="http://schemas.android.com/apk/res-auto"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:removed="@color/gray"

    android:orientation="vertical" >




<com.pixr.photo.cgspecialfx.widget.SquareFrameLayout

        android:id="@+id/squareFrameLayout"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:layout_centerInParent="true"

        android:layout_below="@+id/adView"

        android:removed="@android:color/white" >

        <ViewStub

            android:id="@+id/changeLayout"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            layout="@layout/college_item_one" />

        <ImageView

            android:id="@+id/ivFrame"

            android:layout_width="match_parent"

            android:layout_height="match_parent" >
        </ImageView>

        <com.pixr.photo.cgspecialfx.widget.PhotoSortrView

            android:id="@+id/photoSorterStickerView"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:visibility="gone" />
    </com.pixr.photo.cgspecialfx.widget.SquareFrameLayout>




</RelativeLayout>





activity.java



activity.java

public class CollegeActivity extends Activity implements OnClickListener,
		OnTouchListener, OnItemClickListener, SeekBar.OnSeekBarChangeListener {




@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);

		Intent intent = getIntent();
		int id = intent.getIntExtra(Utils.GRID_ITEM_NO, 0);
		setLayoutBasedFromChooser(id);

		ParseInstallation.getCurrentInstallation().saveInBackground();
	}







private void setLayoutBasedFromChooser(int id) {
		System.out.println("Selected ID is : - " + id);
		switch (id) {
		case 0:
			layout = R.layout.one;
			break;
}
		setContentView(R.layout.college_main);

		initilizationView();
	}
private void initilizationView() {

		squareFrameLayout = (SquareFrameLayout) findViewById(R.id.squareFrameLayout);
		stub = (ViewStub) findViewById(R.id.changeLayout);
		stub.setLayoutResource(layout);
		View inflated = stub.inflate();

              includeView1 = (View) findViewById(R.id.view1);

if (includeView1 != null) {
			pView1 = (PhotoSortrView) includeView1
					.findViewById(R.id.photoSortrViewOne);
			pView1.setBackgroundColor(Color.DKGRAY);
			params1 = (RelativeLayout.LayoutParams) pView1.getLayoutParams();
			ivSelectorImage[0] = (ImageView) includeView1
					.findViewById(R.id.ivOne);

@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.ivOne:
			pSelected = pView1;
			onGalleryClicked();
			break;
}}
		}



......



我尝试了什么:



以上的代码将给出一个方形的网格我想把它变成圆形。我应该怎么做..?


......

What I have tried:

above code will give a square shape grid i want make it as a round shape .what should i do..?

推荐答案

这里有几件事情。您是否尝试通过xml代码创建自定义圆形并将其应用于imageview中?你是否尝试过这种圆形作为 photosortrview 的背景?



除了这两个选项还有另外一个,从原始创建自定义形状的imageview像这样的代码一个 [ ^ ]并将其应用于默认的imageview。希望你明白。
Couple of things here. Do you tried creating a custom round shape by xml code and apply it inside imageview? Do you tried that round shape as a background of photosortrview?

Beyond these 2 options there is another one, create custom shaped imageview from raw code like this one [^]and apply it in place of default imageview. Hope you get it.


这篇关于我可以将圆形应用于以下代码..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆