Add CSS-style padding support to LinearLayout. Use to improve the look

This commit is contained in:
Henrik Rydgård
2022-12-08 00:01:46 +01:00
parent 42b74c6a9a
commit 3e7f7ad8d7
4 changed files with 38 additions and 27 deletions
+8 -6
View File
@@ -203,14 +203,16 @@ void DisplayLayoutScreen::CreateViews() {
// impossible.
root_->SetExclusiveTouch(true);
ScrollView *leftScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(400.0f, FILL_PARENT, 10.f, 10.f, NONE, 10.f, false));
ViewGroup *leftColumn = new LinearLayout(ORIENT_VERTICAL);
ScrollView *leftScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(420.0f, FILL_PARENT, 0.f, 0.f, NONE, 0.f, false));
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL);
leftColumn->padding.SetAll(8.0f);
leftScrollView->Add(leftColumn);
leftScrollView->SetClickableBackground(true);
root_->Add(leftScrollView);
ScrollView *rightScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(300.0f, FILL_PARENT, NONE, 10.f, 10.f, 10.f, false));
ViewGroup *rightColumn = new LinearLayout(ORIENT_VERTICAL);
ScrollView *rightScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(300.0f, FILL_PARENT, NONE, 0.f, 0.f, 0.f, false));
LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL);
rightColumn->padding.SetAll(8.0f);
rightScrollView->Add(rightColumn);
rightScrollView->SetClickableBackground(true);
root_->Add(rightScrollView);
@@ -220,8 +222,8 @@ void DisplayLayoutScreen::CreateViews() {
// Set backgrounds for readability
Drawable backgroundWithAlpha(GetBackgroundColorWithAlpha(*screenManager()->getUIContext()));
leftScrollView->SetBG(backgroundWithAlpha);
rightScrollView->SetBG(backgroundWithAlpha);
leftColumn->SetBG(backgroundWithAlpha);
rightColumn->SetBG(backgroundWithAlpha);
if (!IsVREnabled()) {
auto stretch = new CheckBox(&g_Config.bDisplayStretch, gr->T("Stretch"));