我正在尝试学习简单的TransitionManager工作,但我有点卡住......
我的目标是通过图片点击在两个场景之间进行切换。但在第一次图像点击和第一次场景变换后,我无法捕捉图像点击...
这是我的片段代码:
<RelativeLayout
android:id="@+id/relative"
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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:showIn="@layout/activity_main"
tools:context=".MainActivityFragment">
<include
layout="@layout/scene1"
/>
</RelativeLayout>
片段xml:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/text"
android:text="Hello World!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:layout_alignParentTop="true"
android:layout_toRightOf="@id/image"
android:layout_margin="5dp"
/>
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
scene1 xml:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/text"
android:text="Hello World!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@id/image"
/>
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
scene2 xml:
while(node->next != node_I_want_to_remove){
node = node->next;
}
Node* tmp = node->next->next; // save the next
remove(node->next);
node->next = tmp; // attach the two ends of the list and keep iterating
你知道我哪里出错吗?
答案 0 :(得分:1)
您需要再次设置onClickListeners才能使其正常工作。
在onCreateView中,您可以直接调用setListeners方法。
public funcion store()
{
// do validation here
try{
$post = new Post;
$post->title = $request->title;
$post->subtitle = $request->subtitle;
$post->slug = $request->slug;
$post->body = $request->body;
$post->status = 1;
$post->save(); // This works correct
$post->tags->sync($request->tags); // Not working
$post->categories->sync($request->categories); // Not working
}
catch(\Exception $e){
return redirect(route('post.index'))->with('message', 'Error Adding Post into system!'.$e->getMessage()); // getting Message "Method sync does not exist. "
}
}
答案 1 :(得分:-1)
有趣的是(尽管几乎所有教程都是一样),当我更改容器ID时,它开始起作用了。您也可以尝试使用相同的方法来查看它是否有效。