ну да, итем назначается в адаптере ж.
Добавлено через 50 секунд
да я уж по разному пробовал
fab = (FloatingActionButton) getView().findViewById(R.id.fab);
fab = (FloatingActionButton) v.findViewById(R.id.fab);
ListFragment
XML |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView"
android:layout_margin="@dimen/activity_vertical_margin"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add_white_24dp"
app:layout_anchor="@id/listView"
app:layout_anchorGravity="bottom|right|end"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:backgroundTint="@color/colorAccent"
app:rippleColor="@color/colorPrimary"/>
</android.support.design.widget.CoordinatorLayout> |
|
List_item
XML |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/activatedBackgroundIndicator">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/no_avatar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/name"
android:layout_gravity="top|center_horizontal"
android:layout_marginLeft="10dp"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkbox"
android:id="@+id/checkBox"
android:clickable="true"
android:paddingLeft="@dimen/abc_action_bar_overflow_padding_start_material"
android:singleLine="false"
android:textAppearance="@color/colorAccent"
android:layout_gravity="right" />
</LinearLayout> |
|