我想在ciruclarMenu https://i.stack.imgur.com/MPXAA.png的中间添加圆形图像视图。这是xml代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:circle="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SampleActivity" >
<com.example.logan.rotatingwheelcontrol.CircleLayout
android:id="@+id/circle_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/selected_textView"
android:layout_gravity="center_horizontal" >
<include layout="@layout/menu_items" />
</com.example.logan.rotatingwheelcontrol.CircleLayout>
<TextView
android:id="@+id/selected_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
这是menu_items代码:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:circle="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.example.logan.rotatingwheelcontrol.CircleImageView
android:id="@+id/main_calendar_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:elevation="2dp"
android:src="@drawable/ic_calendar"
circle:name="@string/calendar" />
<com.example.logan.rotatingwheelcontrol.CircleImageView
android:id="@+id/main_cloud_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:elevation="2dp"
android:src="@drawable/ic_cloud"
circle:name="@string/cloud" />
<com.example.logan.rotatingwheelcontrol.CircleImageView
android:id="@+id/main_mail_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:elevation="2dp"
android:src="@drawable/ic_mail"
circle:name="@string/mail" />
<com.example.logan.rotatingwheelcontrol.CircleImageView
android:id="@+id/main_key_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:src="@drawable/ic_key"
circle:name="@string/key" />
<com.example.logan.rotatingwheelcontrol.CircleImageView
android:id="@+id/main_profile_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:elevation="2dp"
android:src="@drawable/ic_profile"
circle:name="@string/profile" />
<com.example.logan.rotatingwheelcontrol.CircleImageView
android:id="@+id/main_tap_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:elevation="2dp"
android:src="@drawable/ic_tag"
circle:name="@string/tag" />
</merge>
我正在使用此存储库来制作圆形菜单“https://github.com/szugyi/Android-CircleMenu” 我需要在上面的代码中进行哪些更改才能执行此操作。 我是android的新手,任何帮助都会得到帮助。
由于
答案 0 :(得分:0)
可以通过技巧完成。只需在xml中添加一个额外的相对布局,方法是将其与放置CircleLayout的相同位置对齐。然后在此相对布局的中心添加圆形图像视图。
通过此更改,您的XML布局将如下所示:
CircleImageView centerImageView = (CircleImageView) findViewById(R.id.center_image);
centerImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Center Image View Clicked", Toast.LENGTH_SHORT).show();
}
});
要收听中心图片的点击事件,您需要在活动中添加以下代码。
If String.Compare(sStep, "SFOUND", True) = 0 Then
RCFileUpload.Disabled = True
End If