mirror of
https://github.com/niushuai233/DevControl.git
synced 2024-10-27 22:43:20 +08:00
feat: 调整页面布局
This commit is contained in:
parent
8f4e9d8078
commit
b003dd17bb
@ -60,13 +60,16 @@ public class NavDeviceFragment extends Fragment {
|
|||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
HashMap<String, Object> m1 = new HashMap<>();
|
HashMap<String, Object> m1 = new HashMap<>();
|
||||||
|
|
||||||
m1.put("device_item_imageView", R.drawable.ic_mark_as_read);
|
m1.put("device_item_cardView_image", R.drawable.ic_device_light_1);
|
||||||
m1.put("device_item_textView", "卧室灯" + i);
|
m1.put("device_item_cardView_text", "卧室灯" + i);
|
||||||
dataItem.add(m1);
|
dataItem.add(m1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SimpleAdapter gvAdapter = new SimpleAdapter(getContext(), dataItem, R.layout.device_item,
|
||||||
|
// new String[]{"device_item_cardView_text"}, new int[]{R.id.device_item_cardView_text});
|
||||||
|
|
||||||
SimpleAdapter gvAdapter = new SimpleAdapter(getContext(), dataItem, R.layout.device_item,
|
SimpleAdapter gvAdapter = new SimpleAdapter(getContext(), dataItem, R.layout.device_item,
|
||||||
new String[]{"device_item_imageView", "device_item_textView"}, new int[]{R.id.device_item_imageView, R.id.device_item_textView});
|
new String[]{"device_item_cardView_image", "device_item_cardView_text"}, new int[]{R.id.device_item_cardView_image, R.id.device_item_cardView_text});
|
||||||
|
|
||||||
deviceGv.setAdapter(gvAdapter);
|
deviceGv.setAdapter(gvAdapter);
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@id/device_item"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@id/device_item_cardView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
android:layout_centerInParent="true">
|
||||||
|
|
||||||
<ImageView
|
<RelativeLayout
|
||||||
android:id="@+id/device_item_imageView"
|
android:id="@id/device_item_cardView_content"
|
||||||
android:layout_width="56dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="56dp"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/ic_home"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_centerHorizontal="true"
|
>
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/device_item_textView"
|
android:id="@id/device_item_cardView_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="55dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="55dp"
|
||||||
android:layout_below="@id/device_item_imageView"
|
app:srcCompat="@drawable/ic_home" />
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:text="TextView"
|
<TextView
|
||||||
/>
|
android:id="@id/device_item_cardView_text"
|
||||||
</RelativeLayout>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/device_item_cardView_image"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:textSize="12dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:shadowColor="#000000"
|
||||||
|
android:shadowDx="0.3"
|
||||||
|
android:shadowDy="0.3"
|
||||||
|
android:shadowRadius="0.3"
|
||||||
|
android:text="TextView" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</RelativeLayout>
|
||||||
|
@ -19,10 +19,14 @@
|
|||||||
</androidx.gridlayout.widget.GridLayout>
|
</androidx.gridlayout.widget.GridLayout>
|
||||||
|
|
||||||
<GridView
|
<GridView
|
||||||
android:id="@+id/device_gv"
|
android:id="@id/device_gv"
|
||||||
|
android:paddingTop="25dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:numColumns="2"
|
android:numColumns="2"
|
||||||
|
android:verticalSpacing="12dp"
|
||||||
|
android:horizontalSpacing="12dp"
|
||||||
|
android:background="@color/main_bg_color"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -7,4 +7,6 @@
|
|||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="gray">#FFAFAFAF</color>
|
||||||
|
<color name="main_bg_color">#F6F6F6</color>
|
||||||
</resources>
|
</resources>
|
@ -6,4 +6,13 @@
|
|||||||
<item name="bottom_nav_set" type="id"/>
|
<item name="bottom_nav_set" type="id"/>
|
||||||
<!-- 首页 底部导航栏 end-->
|
<!-- 首页 底部导航栏 end-->
|
||||||
|
|
||||||
|
<!--设备页 start-->
|
||||||
|
<item name="device_gv" type="id"/>
|
||||||
|
<item name="device_item" type="id"/>
|
||||||
|
<item name="device_item_cardView" type="id"/>
|
||||||
|
<item name="device_item_cardView_content" type="id"/>
|
||||||
|
<item name="device_item_cardView_image" type="id"/>
|
||||||
|
<item name="device_item_cardView_text" type="id"/>
|
||||||
|
<!--设备页 end-->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user