Monday, May 5, 2014

Not familiar with programming for android, ask two questions


Not familiar with programming for android, ask two questions
First, read and write files, how to read and write the specified location, such as a file has 1024 bytes, I want to read only the first 500 bytes to 600 bytes how to do, is not necessarily to read 600 bytes and then throw away the first 500 bytes, which is not what I want, for example, if the file has 2G, 2G wholly impossible to read out of it
Second, the layout is definitely not recommended, but I want to run after the program is able to set my interface, want to put the button onto the place, it could change the button layout is definitely replace what way. (Originally under 2.3 can be used with absolute layout, now at 4.2 operating under the same code to die, is not the absolute layout is no longer supported)
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
You can add your own plus a logic output file stream
2 You can use multiple nested layout
Reply:
A file stream that generally seek to know this stuff.
He did not so used on android. You simply check on it.
Reply:
Thanks to both answers, but for the second question, after running to change the position of the controls, I do not know how to use nested, it should be very complicated, I am currently using a relative layout, set up each control ID, the user interface settings , remember to save the controls next to the controls, which can basically achieve the goal, but still not as good as the layout is definitely convenient, but restrictions are also great, do not know how to think GOOGLE, with code layout, the layout is definitely better than any relative layout, performance or, how not support it? The first question, I use FileOutputStream and FileInputStream, did not find a seek method or setseek
Reply:
1. FileInputStream.skip is to use seek to achieve.
Alternatively, you can use to achieve your needs
RandomAccessFile
2 with FrameLayout realize what's the problem?
Reply:
reference to the third floor fieldisme reply:
thank two answers, but for the second question, after running to change the position of the controls, I do not know how to use nested, it should be very complicated, I am currently using a relative layout, set up each control ID, after the user interface settings, remember to save the controls next to the control, which can basically achieve the goal, but still not as good as the layout is definitely convenient, but restrictions large, do not know how to think GOOGLE, with code layout, the layout is definitely better than any relative layout, performance is good, how can not support it? The first question, I use FileOutputStream and FileInputStream, did not find seek or setseek method

Unless you just absolutely layout application screen adaptation, and now so many android phones, various screen sizes, resolutions. Absolute layout barely use.
Reply:
references, 4th Floor youngc527 reply:
1 FileInputStream.skip is to use seek to achieve.
Alternatively, you can use to achieve your needs
RandomAccessFile
2 with the realization of what's the problem?


I am a novice, the original will be c + +, just turn around, thank you for your ideas, but I checked the FrameLayout, all placed in the layout of the controls are in accordance with the level of the stack in the upper left corner of the screen. After covering the front of the controls add to the mix of control. In FrameLayout layout, the definition of the location of any space-related properties are meaningless. I do not know how to use this stuff, I just want to define the location of properties that it actually meaningless. Also, my original phone is version 2.3, 4.2 out change, and when the absolute layout think so, get pixel screen before each run, the location information stored in my control is a logical value, the screens average into 1000 points, on a different phone, the screen pixel by 1000, the value obtained by multiplying the coordinates of my control, the size of the value, and then show up, there should not have different phone display is not the same situation
Reply:
lz look at it relative layout and linear layout
Reply:
1, the first question simply does not belong to Android development problem is the problem of Java IO streams, the landlord can see Java SE related knowledge. Well, the foundation is very important.

2, you can use a nested layout. Think the layout can be achieved with relative effect of what you said.
Reply:
The knot posted, youngc527 first question has been answered, the second question I have actually achieved relative layout, but more complex than absolute layout, but also larger than the absolute limit distribution, relative layout controls only need to save their left , top, width, height on the line, relative to the layout have to remember what the controls around, what is the relationship with the surrounding controls, is very complex, it issued the complaint.
Reply:
reference to the 6th floor fieldisme reply:
Quote: references to the 4th floor youngc527 reply:

1. FileInputStream.skip is to use seek to achieve.
Alternatively, you can use to achieve your needs
RandomAccessFile
2 with the realization of what's the problem?


I am a novice, the original will be c + +, just turn around, thank you for your ideas, but I checked the FrameLayout, all placed in the layout of the controls are in accordance with the level of the stack in the upper left corner of the screen. After covering the front of the controls add to the mix of control. In FrameLayout layout, the definition of the location of any space-related properties are meaningless. I do not know how to use this stuff, I just want to define the location of properties that it actually meaningless. Also, my original phone is version 2.3, 4.2 out change, and when the absolute layout think so, get pixel screen before each run, the location information stored in my control is a logical value, the screen average into 1000 points, on a different phone, the screen pixel by 1000, the value obtained by multiplying the coordinates of my control, the size of the value, and then show up, there should not have different phone display is not the same situation


When using FrameLayout, child's layout_marginLeft, layout_marginTop, layout_gravity can be used to fulfill your needs

No comments:

Post a Comment