Я пытаюсь построить калькулятор RPN
Клавиатура довольно хорошо сжимается и растягивается, поэтому я хотел бы добавить строки стека к виду (выделение синим цветом)
3: 0
2: 0
1: 0
Пока на экране больше нет места / вид.
xml для первой строки и ее контейнер.
<LinearLayout
android:id="@+id/stackLayout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_gravity="bottom|fill_vertical"
android:layout_weight="1"
android:gravity="bottom"
android:orientation="vertical" >
<!-- Stack row -->
<LinearLayout
android:id="@+id/stackRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
>
<!-- Row index -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1:"
style="@style/text_style" />
<!-- Value -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|right"
android:singleLine="true"
android:text="0"
style="@style/text_style" />
</LinearLayout>
</LinearLayout>
Моя неудачная попытка добавить элементы в действиях по созданию
// Setup table rows for value stack
LinearLayout stackView = (LinearLayout) findViewById(R.id.stackLayout);
int heightPx = stackView.getHeight();
LinearLayout stackRow = (LinearLayout) findViewById(R.id.stackRow);
int rowHeightPx = stackRow.getHeight();
// Space for additional rows
int heightLeftPx = heightPx - rowHeightPx;
//stackView.removeView(stackRow);
// Add rows to fit
int count = 0;
while (heightLeftPx > rowHeightPx) {
count++;
// add new LinearLayout row
heightLeftPx-= rowHeightPx;
}
StakeView сообщает о своей высоте как 0. Как и строка.
Куда я иду не так?
Я пытался переместить это в onStart, onResume и onPostResume с тем же результатом.