I'd like to put in the SeekBar of AlertDialog and display it vertically.

Asked 1 years ago, Updated 1 years ago, 84 views

<?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">
    <SeekBar
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:id="@+id/seekBar1"
        android:max="100"
        android:rotation="270" />
</LinearLayout>
       private static void _EBL1_Adjust_Button_Click(object sender, EventArgs e)
        {
            //_EBL1_SeekBar.Visibility = ViewStates.Visible;
            RadarDispActivity._Adpater_Menu.Visibility = ViewStates.Invisible;

            ShowDialog();

            _Handler = GetHandler(AbstractDataInterface.IDX_PROCS_DISP_DATA);
            _Message = _Handler.ObtainMessage();
            //_Handler.SendEmptyMessageDelayed(0, 3000);
            _Message.What = Fec.Test.RadarCmdMessage.MsgOthers.Req.EBL1_Adjust;
            _Handler.SendMessage(_Message);
        }

        private static void ShowDialog()    
        {
            AlertDialog.Builder popDialog = new AlertDialog.Builder(RadarDispActivity.instance);
            LayoutInflater wwwwq = (LayoutInflater)RadarDispActivity.instance.GetSystemService(Context.LayoutInflaterService);
            View layout = wwwwq.Inflate(Resource.Layout.SeekBar_Dialog_Layout, null);
            SeekBar _ssseekbar = (SeekBar)layout.FindViewById(Resource.Id.seekBar1);

            popDialog.SetView(_ssseekbar);

            _ssseekbar.ProgressChanged += (a, b) =>
            {
                //_Data_Edit.PutInt("EBL1_1SeekBar2", b.Progress).Apply();


                //_Handler = GetHandler(AbstractDataInterface.IDX_PROCS_DISP_DATA);
                //_Message = _Handler.ObtainMessage();
                ////_Handler.SendEmptyMessageDelayed(0, 3000);
                //_Message.What = Fec.Test.RadarCmdMessage.MsgOthers.Req.EBL1_Adjust;
                //_Message.Obj = b.Progress;
                //_Message.Arg1 = _EBL1_Arg1;
                //_Handler.SendMessage(_Message);


                //_EBL1_Arg1 = 0;
            };


            Dialog dialog = popDialog.Create();
            //popDialog.Create();

            WindowManagerLayoutParams lp = new WindowManagerLayoutParams();
            lp.CopyFrom(dialog.Window.Attributes);
            lp.X = 512;
            lp.Width = 100;
            lp.Height = 500;

            ((ViewGroup)_ssseekbar.Parent).RemoveView(_ssseekbar);
            dialog.Show();
            Window window = dialog.Window;
            window.Attributes = lp;

            //AlertDialog.Builder _Bulider = new AlertDialog.Builder(Application.Context);
            //LayoutInflater inflater = (LayoutInflater)Application.Context.GetSystemService(Context.LayoutInflaterService);
            //View layout = inflater.Inflate(Resource.Layout.SeekBar_Dialog_Layout, null);

            //AlertDialog dialog = _Bulider.Create();
            //dialog.Show();

            //_VRM1_SeekBar = (SeekBar)layout.FindViewById(Resource.Id.seekBar1);

        }

If you press a button like this, I want to put the SeekBar up vertically in AlertDialog If you turn it around 270 degrees with Rotation,

It comes out a little bit like this. Is there any way to make the height longer?

alertdialog seekbar

2022-09-22 19:32

1 Answers

Please change the layout_width of SeekBar to match_parent and layout_height to wrap_content.

To increase the overall size of the AlertDialog, modify and apply the AlertDialog theme.

If AlertDialog contains complex logic, try DialogFragment rather than alertDialog.


2022-09-22 19:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.