HorizontalScrollView ScrollView horizontal vertical Android xml example
HorizontalScrollView ScrollView LinearLayout horizontal vertical Android xml basic example and image.
[caption id="attachment_889" align="alignleft" width="200" caption="horizontal scrollview horizontalscrollview android"]
[/caption]
Other sample
[caption id="attachment_889" align="alignleft" width="200" caption="horizontal scrollview horizontalscrollview android"]

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="//schemas.android.com/apk/res/android">
// horizontal and vertical Scrollview
<ScrollView android:id="@+id/ScrollView01"
android:layout_height="135px" android:layout_width="wrap_content"
android:scrollbars="horizontal|vertical">
// HorizontalScrollview
<HorizontalScrollView android:id="@+id/HorizontalScrollView01"
android:layout_height="fill_parent" android:layout_width="wrap_content">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="wrap_content" android:orientation="vertical"
android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:text="red" android:gravity="center_horizontal"
android:background="#aa0000" android:layout_width="200px"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="green" android:gravity="center_horizontal"
android:background="#00aa00" android:layout_width="200px"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="blue" android:gravity="center_horizontal"
android:background="#0000aa" android:layout_width="200px"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="yellow" android:gravity="center_horizontal"
android:background="#aaaa00" android:layout_width="200px"
android:layout_height="fill_parent" android:layout_weight="1" />
</LinearLayout>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:text="row one" android:textSize="15pt"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView android:text="row two" android:textSize="15pt"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView android:text="row three" android:textSize="15pt"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView android:text="row four" android:textSize="15pt"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
Other sample
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="//schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layout"
android:orientation="vertical" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello world! First TextView" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
396LW NO topic_id
AD
Další témata ....(Topics)
StringBuilder, res/raw folder, try catch finaly throws, BufferedReader, InputStream, openRawResource, getResources Android example
MainActivity.java
MainActivity.java
public class MainActivity extends Activity {
TextView txtV;
Context cntx;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtV = (TextView)findViewById(R.id.idLabel);
cntx = this;
try {
StringBuilder strBuilder = myFunction(cntx);
txtV.setText(strBuilder);
} catch (IOException e) {
e.printStackTrace();
}
}
private StringBuilder myFunction(Context context) throws IOException {
final Resources resources = context.getResources();
InputStream inputStream = resources.openRawResource(R.raw.my_file);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder strBuild = new StringBuilder();
try {
String line;
while ((line = reader.readLine()) != null) {
strBuild.append(line);
}
} finally {
reader.close();
}
return strBuild;
}
}
BufferedReader , FileReader, StringBuilder , readLine, close Java example
Android example
Java example
Android example
String MYFILE = "my_file";
FileInputStream fis = openFileInput(MYFILE);
int c; String sText = "";
while((c=fis.read())!=-1)
{
sText += (char)c; // convert int to char
}
fis.close();
Java example
try {
BufferedReader in = new BufferedReader(new FileReader("myfile.txt"));
StringBuilder strBuilder = new StringBuilder();
String str;
while ((str = in.readLine()) != null) {
strBuilder.append(str);
}
in.close();
} catch (IOException e) {
e.toString();
}
How to quickly change all icon set in .apk project with Eclipse:
Right click on project in folder tree
Select New - Ohter
In open wizard dialog select Android Icon Set
Set Icon set name:
Open some large icon for your project for example 512x512 px and wizard will make all set of icons from one largest icon:
Wizard will create all set of icons from this one largest icon.
Click on finish button:
Right click on project in folder tree
Select New - Ohter

In open wizard dialog select Android Icon Set

Set Icon set name:

Open some large icon for your project for example 512x512 px and wizard will make all set of icons from one largest icon:

Wizard will create all set of icons from this one largest icon.
Click on finish button:

Admob testing on emulator issue.
Android Eclipse code warning:
setTesting(boolean) from the type AdRequest is deprecated
Solution:
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
Android Eclipse code warning:
setTesting(boolean) from the type AdRequest is deprecated
Solution:
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
AdView adView = new AdView(this, AdSize.BANNER, "a14d9..........");//MY_AD_UNIT_ID
AdRequest adRequest = new AdRequest();
adRequest.setTesting(true); // deprecated
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // OK
adView.loadAd(adRequest);
This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in
Click on menu Help > Install New Software.
In the Work with field, Add: https://dl-ssl.google.com/android/eclipse/
Select: Developer Tools / Android Development Tools.
Click Next to complete the wizard.
If you have problem try download all sdk + eclipse in one pack , rename old folder for example Andorid_old, create new folder Android and unpack sdk + eclipse from this adress:
//developer.android.com/sdk/index.html

Click on menu Help > Install New Software.
In the Work with field, Add: https://dl-ssl.google.com/android/eclipse/
Select: Developer Tools / Android Development Tools.
Click Next to complete the wizard.
If you have problem try download all sdk + eclipse in one pack , rename old folder for example Andorid_old, create new folder Android and unpack sdk + eclipse from this adress:
//developer.android.com/sdk/index.html

Editace: 2011-10-22 09:17:39
Počet článků v kategorii: 396
Url:horizontalscrollview-scrollview-horizontal-vertical-android-xml-example