TextView not scrolling Smoothly - java

I am trying to scroll my textview using the following code:
TextView text = (TextView) findViewById(R.id.textView12);
text.setMovementMethod(ScrollingMovementMethod.getInstance());
int height = getResources().getDrawable(R.drawable.pic_ground_pranic).getIntrinsicHeight();
text.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, height));
text.setText("As part of an Android App I am building a button set.For performance reasons and to keep the code simpler, the Android system uses pixels as the standard unit for expressing dimension or coordinate values. That means that the dimensions of a view are always expressed in the code using pixels, but always based on the current screen density. For instance, if myView.getWidth() returns 10, the view is 10 pixels wide on the current screen, but on a device with a higher density screen, the value returned might be 15. If you use pixel values in your application code to work with bitmaps that are not pre-scaled for the current screen density, you might need to scale the pixel values that you use in your code If you need to control exactly how your application will look on various screen configurations, adjust your layouts and bitmap drawables in configuration-specific resource directories. For example, consider an icon that you want to display on medium and high density screens. Simply create your icon at two different sizes (for instance 100x100 for medium density and 150x150 for high density) and put the two variations in the appropriate directories, using the proper qualifiers: For instance, suppose a device has a WVGA high-density screen, which is 480x800 and about the same size as a traditional HVGA screen, but it's running an application that has disabled pre-scaling. In this case, the system will lie to the application when it queries for screen dimensions, and report 320x533 (the approximate mdpi translation for the screen density). Then, when the application does drawing operations, such as invalidating the rectangle from (10,10) to (100, 100), the system transforms the coordinates by scaling them the appropriate amount, and actually invalidate the region (15,15) to (150, 150). This discrepancy may cause unexpected behavior if your application directly manipulates the scaled bitmap, but this is considered a reasonable trade-off to keep the performance of applications as good as possible. If you encounter this situation, read Based on the density of the current screen, the system uses any size- or density-specific resources from your application and displays them without scaling. If resources are not available in the correct density, the system loads the default resources and scales them up or down as needed to match the current screen's density. The system assumes that default resources (those from a directory without configuration qualifiers) are designed for the baseline screen density (mdpi), unless they are loaded from a density-specific resource directory. Pre-scaling is, thus, what the system does when resizing a bitmap to the appropriate size for the current screen density. to match the un-scaled bitmap source. The buttons are part of a nested set of LinearLayouts.The question then is: How to resize the layout.I have tried several suggested techniques, and none come close to working. Here is a subset of the XML that builds the button set:");
All is working fine but my text view is not scrolling smoothly. I thought I have to put my Textview inside a Scrollview but this is also not working.
Does it happen because I am resizing my textview?
Please provide any solution for this problem. I already spent a lot of time on this.
My xml layout file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/include1"
android:layout_centerHorizontal="true"
android:background="#android:color/white"
android:scrollbarStyle="insideInset" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="14dp"
android:text="Text 1"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/textView2"
android:text="Text 2"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView3"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/textView3"
android:text="Text 3"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView4"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/textView4"
android:text="Text 4"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView2"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_below="#+id/textView3"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView4"
android:layout_below="#+id/textView4"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_below="#+id/textView5"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:soundEffectsEnabled="true" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Volume 1"
android:textColor="#android:color/black" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<SeekBar
android:id="#+id/seekBar2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:soundEffectsEnabled="true" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Volume 2"
android:textColor="#android:color/black" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:baselineAligned="false" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Save Volumes" />
</LinearLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/frameLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="vertical" >
<TextView
android:id="#+id/textView12"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="top|left"
android:scrollbars="vertical"
android:visibility="visible" />
</FrameLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<FrameLayout
android:id="#+id/frameLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_marginRight="30dp"
android:clickable="true"
android:text="Detailed Instruction" />
</FrameLayout>
</TableRow>
</TableLayout>
</ScrollView>
</RelativeLayout>
Thanks in advance!

In my case I just needed to put my TextView inside a ScrollView. Scrolling got very smooth and users lived happily every after!
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
>
<TextView
android:id="#+id/textview_about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="20dp" />
</ScrollView>

problem is ScrollView inside ScrollView.
When you put ScrollView inside ScrollView android just get confused which scroll view is touched. So sometimes it gets unable to deliver touch event.
After searching for a time I found a link or blog that will extract this problem and also have solution.
Take a look at this blog. This is exactly what you have been searching for and i am sure that it will solve your problem.
Now time to Enjoy ;)

The TextView scroll only if you restrict its height. Simple rule is when the text is more then the available space then textview start scrolling.
One way is what you are following by assigning a fixed height which you got from some image size. One other way is by setting the maximum number of lines.
TextView text = (TextView) findViewById(R.id.textView12);
text.setMaxLines(5);
text.setMovementMethod(ScrollingMovementMethod.getInstance());
you can even make it more dynamic. Simply by calculating number of lines.
Number of lines = (image Height in pixels)/(text font size in pixel)

First of all there is no need of the setting the Layoutparams as because you have give it in to the xml layout.
And if you have such long string then dont put it directly on java code. Instead of it put that string to the resources directory.
go to values, and open strings.xml file and define your string.
See below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelperStackOverflowActivity!</string>
<string name="app_name">HelperStackOverflow</string>
<string name="String1">"PUT YOUR STRING HERE" </string>
</resources>
After doing that set the string in Java code whenever you want.
as like:
text = (TextView)findViewById(R.id.textView12);
text.setText(getResources().getString(R.string.String1));
it Scroll nice as normal scrolling.
Hope it will help you.
Enjoy. :)

Related

Android Studio components not centering correctly when tested on an external device

I have a simple app written in Java that I am trying to make work on Android devices. The code runs without issue, but the layout of the widgets is inconsistent.
I want all of them to be centered on the screen, and this works when I run the program in an emulator from Android Studio- I have tried this with an emulated Nexus 6P and a Pixel 3A.
However, when I run the program on a physical device, a Galaxy S9, some of the widgets are no longer centered.
I have tried centering the gravity for the RelativeLayout, and using android:layout_centerHorizontal="true" for each of the widgets. I also tried setting the size of the widgets to match_parent and then centering the gravity horizontally inside them. So far this has all given the same result.
I include the XML code below, along with two screenshots for comparison, one from the emulated Nexus 6P and one from the Galaxy S9. You should see that the button and the number field are centered, but all of the text is slightly off-centre.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="25dp"
android:editable="false"
android:gravity="center_horizontal"
android:text="Arby's Hi-Lo Guessing Game"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:visibility="visible" />
<TextView
android:id="#+id/txtPrompt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="-2dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="75dp"
android:gravity="center|center_horizontal"
android:text="Enter a number between 1 and 100:"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:layout_alignParentLeft="true" />
<EditText
android:id="#+id/txtGuess"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="105dp"
android:layout_marginEnd="166dp"
android:layout_marginRight="166dp"
android:ems="10"
android:gravity="center_horizontal"
android:inputType="number" />
<Button
android:id="#+id/btnGuess"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:layout_marginTop="175dp"
android:text="Guess!" />
<TextView
android:id="#+id/lblOutput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="250dp"
android:gravity="center_horizontal"
android:text="Enter a number, then click Guess!"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textSize="18sp" />
</RelativeLayout>
Emulator Alignment
Physical Device Alignment
Your views have absolute margins set in dp. These will not look the same on different sized screens. Remove all marginStart, marginEnd, marginRight and marginLeft attributes. Then RelativeLayout should center the views properly.
try this, i did it fast but i hope it wiill work ;)
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:textAlignment="center"
android:layout_marginTop="25dp"
android:editable="false"
android:text="Arby's Hi-Lo Guessing Game"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:visibility="visible"
/>
<TextView
android:id="#+id/txtPrompt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/txtTitle"
android:textAlignment="center"
android:layout_marginTop="25dp"
android:text="Enter a number between 1 and 100:"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
/>
<EditText
android:id="#+id/txtGuess"
android:layout_width="75dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/txtPrompt"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:inputType="number" />
<Button
android:id="#+id/btnGuess"
app:layout_constraintTop_toBottomOf="#+id/txtGuess"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="30dp"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:text="Guess!" />
<TextView
android:id="#+id/lblOutput"
app:layout_constraintTop_toBottomOf="#+id/btnGuess"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="Enter a number, then click Guess!"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textSize="18sp" />
</android.support.constraint.ConstraintLayout>

Fit TextView under ImageView

I have 2 rows of "buttons" which are composed of a vertical LinearLayout of an ImageView and a TextView. The problem I'm having right now is trying to set the ImageView aspect ratio without hardcoding its dimensions.
I have already tried playing with the layout weights but it still forces the TextView to be partially cut off.
The xml structure I have is 2 horizontal LinearLayouts and each button is described above.
I've included a picture of my problem. You can see the first button is forcing the TextView out of the bounds. The rest of the buttons you see are hardcoded dimensions, but I don't want to do that because smaller screen sizes won't work.
Here is my layout for one button:
<LinearLayout
android:gravity="center_horizontal"
android:layout_weight="1"
android:padding="5dp"
android:orientation="vertical"
android:layout_width="0dip"
android:layout_height="match_parent">
<ImageView
android:id="#+id/setting_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:background="#null"
android:clickable="true"
android:onClick="openSettings"
android:src="#drawable/menu" />
<TextView
android:id="#+id/setting_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Settings"
android:textAlignment="center"
android:textColor="#android:color/white"
android:autoSizeTextType="uniform" />
</LinearLayout>
Try using images with lower dimensions.
Try using a RelativeLayout and setting the TextView as anchor for the image:
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp">
<TextView
android:id="#+id/setting_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:text="Settings"
android:textAlignment="center"
android:textColor="#android:color/white"
android:autoSizeTextType="uniform" />
<ImageView
android:id="#+id/setting_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="#id/setting_text"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:background="#null"
android:clickable="true"
android:onClick="openSettings"
android:src="#drawable/menu" />
</RelativeLayout>

I am not able to render the editText properly

I am not able to render EditText properly it going outside the screen
but in Graphical Layout tab in eclipse it is showing properly.
Please help I am new to android. I have written the sample code for 1st row
<RelativeLayout xmlns:android="http://*****.*****.***/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp">
<TableRow>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/editText2"
android:layout_alignParentLeft="true"
android:layout_marginBottom="29dp"
android:layout_marginLeft="0dp"
android:text="Counter Id"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView1"
android:layout_alignBottom="#+id/textView1"
android:layout_marginLeft="0dp"
android:layout_toRightOf="#+id/textView1"
android:ems="10" />
</TableRow>
</TableLayout>
Use Linear Layout with weight sum.
http://developer.android.com/reference/android/widget/LinearLayout.html
Or
Use Different Layouts for different Screen Size.
for Eg: LDPI, MDPI, HDPI, XHDPI, XXHDPI ect.

FrameLayout inside RelativeLayout not showing

I have the following issue. In my layout, which is used as a list item, I have a FrameLayout inside a RelativeLayout. In the Graphical Layout in Eclipse it appears just as expected, however, when I debug in a real device (HTC One V Android 4.0.3 in this case), the FrameLayout does not appear at all (but the area it occupies is visible). In the Adapter I do not play with the visibility, I just change the background color between two colors.
Here is my layout code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="130dp" >
<FrameLayout
android:id="#+id/entryType"
android:layout_width="15dp"
android:layout_height="match_parent"
android:background="#color/color_punch_in_darker"
android:gravity="center" >
</FrameLayout>
<TextView
android:id="#+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:gravity="center"
android:singleLine="true"
android:textColor="#color/color_black"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/clock"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginRight="5dp"
android:layout_marginTop="7dp"
android:layout_toLeftOf="#id/time"
android:src="#drawable/ic_clock" />
<TextView
android:id="#+id/company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#id/clock"
android:layout_toRightOf="#id/entryType"
android:ellipsize="end"
android:gravity="left|top"
android:hint="#string/string_NA"
android:singleLine="true"
android:textColor="#color/color_grey_darker"
android:textSize="18sp" />
<TextView
android:id="#+id/project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#id/company"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toRightOf="#id/entryType"
android:ellipsize="end"
android:gravity="left|top"
android:hint="#string/string_NA"
android:singleLine="true"
android:textColor="#color/color_grey_darker"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/note"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_below="#id/project"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toRightOf="#id/entryType"
android:ellipsize="end"
android:gravity="left|top"
android:hint="#string/string_NA"
android:textColor="#color/color_grey_darker"
android:textSize="18sp"
android:textStyle="italic" />
</RelativeLayout>
In my adapter, the part where I interact with the layout for changing the color (and I assure you is the only part of the code where I interact with the R.id.entryType view), I have the following code:
if(entry.isInEntry())
viewHolder.entryType.setBackgroundColor(getContext().getResources().getColor(R.color.color_punch_in_darker));
else
viewHolder.entryType.setBackgroundColor(getContext().getResources().getColor(R.color.color_punch_out_darker));
The Graphical layout shows the following, which is the correct
But when I debug, the following appears (the arrow and the border shows the area where the color should be, but instead only the width appears)
Many thanks in advance since I do not know what else I can check.
Use foreground attribute for FrameLayout (with no children) instead of background
or add a View (fill_parent) to the FrameLayout
or set the FrameLayout's paddingLeft to 15dp (same as your width)
FrameLayout will measure itself as 0 unless it has a reason to give itself dimension. The layout_widith/height is still reserving it space, but it has no children to draw and your background is a color (therefore it's dimensionless)
try layout_alignParentLeft="true", add some margin for testing for Framelayout and then have the textboxes in reference to that

Scroll view not scrolling android

i tried creating a small game cards game if the first layout the player chooses the character
but the screen not big enough to fit all the characters "3" i tried to set scrollview horizontally to fill parent then specific amount then wrap content but i'm getting tired
<ScrollView
android:layout_marginTop="35dp"
android:layout_width="650dp"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_marginTop="40dp"
android:layout_width="650dp"
android:layout_height="350dp"
>
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/RBarthu_mage"
android:button="#drawable/user_arthu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RadioButton
android:id="#+id/RBDwemer_fighter"
android:button="#drawable/xuser_dwemer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
/>
<RadioButton
android:id="#+id/RBZombie"
android:button="#drawable/xuser_zombie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
/>
</RadioGroup>
</LinearLayout>
</ScrollView>
In your <LinearLayout change the line
...layout_height="350dp"
to
...layout_height="wrap_content"
Note: And just for good practice, change your width of the <LinearLayout to match_parent.

Categories