Use rowSpan and columnSpan attributes for GridLayout contents
This commit is contained in:
parent
bc2446d586
commit
081dd76545
@ -317,8 +317,7 @@ public class EditAlarmActivity extends BaseActivity implements
|
||||
// If we keep a reference to the dialog, we keep its previous state as well.
|
||||
// So the next time we call show() on it, the input field will show the
|
||||
// last inputted time.
|
||||
/*NumpadTimePickerDialog.newInstance(EditAlarmActivity.this)
|
||||
.show(getSupportFragmentManager(), TAG_TIME_PICKER);*/
|
||||
//NumpadTimePickerDialog.newInstance(this).show(getSupportFragmentManager(), TAG_TIME_PICKER);
|
||||
ScrollingGridTimePickerDialog.newInstance(this, true).show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,8 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog {
|
||||
private String[] mValues;
|
||||
private boolean mIs24HourMode;
|
||||
|
||||
@Bind(R.id.grid) RecyclerView mGrid;
|
||||
@Nullable
|
||||
@Bind(R.id.main_content) RecyclerView mGrid;
|
||||
|
||||
public static ScrollingGridTimePickerDialog newInstance(TimePicker.OnTimeSetListener callback, boolean is24HourMode) {
|
||||
ScrollingGridTimePickerDialog ret = new ScrollingGridTimePickerDialog();
|
||||
@ -50,6 +51,7 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog {
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
if (mGrid != null) {
|
||||
mGrid.setLayoutManager(new GridLayoutManager(view.getContext(), COLUMNS));
|
||||
mAdapter = new ScrollingGridAdapter(mValues, new View.OnClickListener() {
|
||||
@Override
|
||||
@ -59,6 +61,7 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog {
|
||||
}
|
||||
});
|
||||
mGrid.setAdapter(mAdapter);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
<Button
|
||||
android:id="@+id/one"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="1"/>
|
||||
@ -11,6 +13,8 @@
|
||||
<Button
|
||||
android:id="@+id/two"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="2"/>
|
||||
@ -25,6 +29,8 @@
|
||||
<Button
|
||||
android:id="@+id/four"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="4"/>
|
||||
@ -32,6 +38,8 @@
|
||||
<Button
|
||||
android:id="@+id/five"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="5"/>
|
||||
@ -39,6 +47,8 @@
|
||||
<Button
|
||||
android:id="@+id/six"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="6"/>
|
||||
@ -46,6 +56,8 @@
|
||||
<Button
|
||||
android:id="@+id/seven"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="7"/>
|
||||
@ -53,6 +65,8 @@
|
||||
<Button
|
||||
android:id="@+id/eight"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="8"/>
|
||||
@ -60,6 +74,8 @@
|
||||
<Button
|
||||
android:id="@+id/nine"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
android:text="9"/>
|
||||
@ -67,6 +83,8 @@
|
||||
<Button
|
||||
android:id="@+id/zero"
|
||||
style="@style/grid_element_single"
|
||||
grid:layout_rowSpan="1"
|
||||
grid:layout_columnSpan="1"
|
||||
grid:layout_rowWeight="1"
|
||||
grid:layout_columnWeight="1"
|
||||
grid:layout_column="1"
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
<Button
|
||||
android:id="@+id/leftAlt"
|
||||
style="@style/grid_element_single"
|
||||
app:layout_rowSpan="1"
|
||||
app:layout_columnSpan="1"
|
||||
app:layout_rowWeight="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_column="0"/>
|
||||
@ -14,6 +16,8 @@
|
||||
<Button
|
||||
android:id="@+id/rightAlt"
|
||||
style="@style/grid_element_single"
|
||||
app:layout_rowSpan="1"
|
||||
app:layout_columnSpan="1"
|
||||
app:layout_rowWeight="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_column="2"/>
|
||||
@ -37,10 +41,10 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/backspace"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/ic_backspace_24dp"
|
||||
android:background="?selectableItemBackground"
|
||||
app:layout_rowSpan="1"
|
||||
app:layout_columnSpan="1"
|
||||
app:layout_rowWeight="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_column="2"/>
|
||||
|
||||
@ -2,16 +2,27 @@
|
||||
<!-- TOneverDO: Use LinearLayout because it doesn't obey LWM -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
<ScrollView
|
||||
android:id="@+id/grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/scrolling_grid_height"
|
||||
android:scrollbars="vertical"
|
||||
android:scrollbarSize="@dimen/scrollbar_width"
|
||||
android:fadeScrollbars="false"
|
||||
android:layout_alignParentTop="true"/>
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<android.support.v7.widget.GridLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:alignmentMode="alignBounds"
|
||||
app:columnCount="3">
|
||||
|
||||
<include layout="@layout/content_grid_layout_numpad"/>
|
||||
<include layout="@layout/content_grid_layout_numpad"/>
|
||||
|
||||
</android.support.v7.widget.GridLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
|
||||
@ -22,8 +22,6 @@
|
||||
</style>
|
||||
|
||||
<style name="grid_element_single">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">0dp</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user