• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Constant battle with Android Studio!

Fair dinkum it is a constant bloody battle with Android Studio to force it to do what I want it to do!
MS Visual Studio is vastly easier to deal with!

How do you stop a listview from filling up the entire screen.

Once again NONE of the suggested solutions have any effect on the listview.

Changing wrap_content/match_parent has no effect.
Creating a custom textview for each list item has no effect.
Changing margins and padding has no effect.
Changing weight has no effect.
Changing minimum and maximum height has not effect.

For frick sakes there MUST be some way to control the dimensions of a listview.
Otherwise is a useless control?
 
I can empathise with you. Android layouts are notoriously fiddly, at least in my experience. As with anything new, it takes time to really get to grips with it and gain a good understanding.
If you would like to post your layout, it might help to clarify the problem, and someone can possibly suggest where you're going wrong.
This isn't a problem with Android Studio per se, which is an excellent IDE - you're just battling with the peculiarities of the UI layout manager.
 
I am bloody well over it!

I gave up with listview and changed to a multiline textview inside scrollview.

But I am little better off!

With wrap_content for textview width I get a narrow box in the middle of the screen.

With match_parent for textview width and margins of 10dp I get a textview filling the entire width of the screen and my text cut off at the left edge.

Setting a fixed width say 300dp I get the same as the above.

All these settings seem to effect the appearance of the layout in Android Studio.

But when I install the app on my phone, the changes to the layout have had no effect on the appearance of my textview in scrollview.

Can some one please just edit this damn layout file below to give me a textview (id_textview_settings) that fills the width of my screen with a small margin at the left and right edges when I compile it for android version 10.

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" />

    <LinearLayout
        android:id="@+id/id_layout_horizontal"
        android:layout_width="395dp"
        android:layout_height="587dp"
        android:layout_gravity="top|center"
        android:gravity="center"
        android:orientation="horizontal">

        <LinearLayout
            android:id="@+id/id_layout_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top|center"
            android:gravity="top|center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/id_textview_display"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Current Settings"
                android:textAlignment="center"
                android:textColor="@color/colorAccent"
                android:textSize="20sp"
                android:textStyle="bold" />

            <ScrollView
                android:id="@+id/id_scrollview_settings"
                android:layout_width="match_parent"
                android:layout_height="496dp"
                android:layout_marginBottom="20dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="20dp"
                android:elevation="1dp">

                <TextView
                    android:id="@+id/id_textview_settings"
                    android:layout_width="wrap_content"
                    android:layout_height="500dp"
                    android:layout_gravity="top|center_horizontal"
                    android:layout_weight="1"
                    android:background="@android:color/background_light"
                    android:inputType="textMultiLine"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="12sp"
                    android:textStyle="bold" />

            </ScrollView>

            <Button
                    android:id="@+id/id_button_back"
                    style="@style/Widget.AppCompat.Button.Colored"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/rounded_rect"
                    android:enabled="true"
                    android:minHeight="30dp"
                    android:minWidth="100dp"
                    android:onClick="SendMessage"
                    android:text="\u003C Back"
                    android:textColor="@android:color/background_light"
                    android:textSize="20sp"
                    android:textStyle="bold" />

        </LinearLayout>

    </LinearLayout>


</LinearLayout>
 
Back
Top Bottom