Search Results

Search found 88 results on 4 pages for 'tablelayout'.

Page 4/4 | < Previous Page | 1 2 3 4 

  • half or quarter black screen in android

    - by Mike McKeown
    I have an android activity that when I launch sometimes (about 1 in 4 times) it only draws quarter or half the screen before showing it. When I change the orientation or press a button the screen draws properly. I'm just using TextViews, Buttons, Fonts - no drawing or anything like that. All of my code for initialising is in the onCreate(). In this method I'm loading a text file, of about 40 lines long, and also getting a shared preference. Could this cause a delay so that it can't draw the intent? Thanks in advance if anyone has seen anything similar. EDIT - I tried commenting out the loading of the word list, but it didn't fix the problem. Here is the activity <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainRelativeLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/blue_abstract_background" > <RelativeLayout android:id="@+id/relativeScore" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <TextView android:id="@+id/ScoreLabel" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:padding="10dip" android:text="SCORE:" android:textSize="18dp" /> /> <TextView android:id="@+id/ScoreText" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@id/ScoreLabel" android:padding="5dip" android:text="0" android:textSize="18dp" /> <TextView android:id="@+id/GameTimerText" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:minWidth="25dp" android:text="0" android:textSize="18dp" /> <TextView android:id="@+id/GameTimerLabel" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toLeftOf="@id/GameTimerText" android:padding="10dip" android:text="TIMER:" android:textSize="18dp" /> /> </RelativeLayout> <RelativeLayout android:id="@+id/relativeHighScore" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/relativeScore" > <TextView android:id="@+id/HighScoreLabel" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:padding="10dip" android:text="HIGH SCORE:" android:textSize="16dp" /> <TextView android:id="@+id/HighScoreText" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/HighScoreLabel" android:padding="10dip" android:text="0" android:textSize="16dp" /> </RelativeLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_below="@+id/relativeHighScore" android:orientation="vertical" > <LinearLayout android:id="@+id/linearMissing" android:layout_width="fill_parent" android:layout_height="80dp" android:layout_gravity="center" android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="2dp" android:background="@color/yellow_text" /> <TextView android:id="@+id/MissingWordText" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="center_horizontal" android:layout_marginTop="25dp" android:text="MSSNG WRD" android:textSize="22dp" android:typeface="normal" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="@color/yellow_text" /> <TableLayout android:id="@+id/buttonsTableLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" > <TableRow android:id="@+id/tableRow3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:paddingTop="5dp" > <Button android:id="@+id/aVowelButton" android:layout_width="66dp" android:layout_height="66dp" android:layout_gravity="center_horizontal" android:layout_marginBottom="10dp" android:layout_marginRight="5dp" android:background="@drawable/blue_vowel_button" android:text="@string/a" android:textColor="@color/yellow_text" android:textSize="30dp" /> <Button android:id="@+id/eVowelButton" android:layout_width="66dp" android:layout_height="66dp" android:layout_gravity="center_horizontal" android:layout_marginBottom="10dp" android:layout_marginRight="5dp" android:background="@drawable/blue_vowel_button" android:text="@string/e" android:textColor="@color/yellow_text" android:textSize="30dp" /> </TableRow> <TableRow android:id="@+id/tableRow4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <Button android:id="@+id/iVowelButton" android:layout_width="66dp" android:layout_height="66dp" android:layout_gravity="center_horizontal" android:layout_margin="5dp" android:background="@drawable/blue_vowel_buttoni" android:text="@string/i" android:textColor="@color/yellow_text" android:textSize="30dp" /> <Button android:id="@+id/oVowelButton" android:layout_width="66dp" android:layout_height="66dp" android:layout_gravity="center_horizontal" android:layout_margin="5dp" android:background="@drawable/blue_vowel_button" android:text="@string/o" android:textColor="@color/yellow_text" android:textSize="30dp" /> <Button android:id="@+id/uVowelButton" android:layout_width="66dp" android:layout_height="66dp" android:layout_gravity="center_horizontal" android:layout_margin="5dp" android:background="@drawable/blue_vowel_button" android:text="@string/u" android:textColor="@color/yellow_text" android:textSize="30dp" /> </TableRow> </TableLayout> <TextView android:id="@+id/TimeToStartText" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="24dp" /> <Button android:id="@+id/startButton" style="@style/yellowShadowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="10dp" android:background="@drawable/blue_button_menu" android:gravity="center" android:padding="10dip" android:text="START!" android:textSize="28dp" /> </LinearLayout> </RelativeLayout> And the OnCreate() and a few methods: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); isNewWord = true; m_gameScore = 0; m_category = getCategoryFromExtras(); // loadWordList(m_category); initialiseTextViewField(); loadHighScoreAndDifficulty(); setFonts(); setButtons(); setStartButton(); enableDisableButtons(false); } private void loadHighScoreAndDifficulty() { //setting preferences SharedPreferences prefs = this.getSharedPreferences(m_category, Context.MODE_PRIVATE); int score = prefs.getInt(m_category, 0); //0 is the default value m_highScore = score; m_highScoreText.setText(String.valueOf(m_highScore)); prefs = this.getSharedPreferences(DIFFICULTY, Context.MODE_PRIVATE); m_difficulty = prefs.getString(DIFFICULTY, NRML_DIFFICULTY); } private void initialiseTextViewField() { m_startButton = (Button) findViewById(R.id.startButton); m_missingWordText = (TextView) findViewById(R.id.MissingWordText); m_gameScoreText = (TextView) findViewById(R.id.ScoreText); m_gameScoreLabel = (TextView) findViewById(R.id.ScoreLabel); m_gameTimerText = (TextView) findViewById(R.id.GameTimerText); m_gameTimerLabel = (TextView) findViewById(R.id.GameTimerLabel); m_timeToStartText = (TextView) findViewById(R.id.TimeToStartText); m_highScoreLabel = (TextView) findViewById(R.id.HighScoreLabel); m_highScoreText = (TextView) findViewById(R.id.HighScoreText); } private String getCategoryFromExtras() { String category = ""; Bundle extras = getIntent().getExtras(); if (extras != null) { category = extras.getString("category"); } return category; } private void enableDisableButtons(boolean enable) { Button button = (Button) findViewById(R.id.aVowelButton); button.setEnabled(enable); button = (Button) findViewById(R.id.eVowelButton); button.setEnabled(enable); button = (Button) findViewById(R.id.iVowelButton); button.setEnabled(enable); button = (Button) findViewById(R.id.oVowelButton); button.setEnabled(enable); button = (Button) findViewById(R.id.uVowelButton); button.setEnabled(enable); } private void setStartButton() { m_startButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { m_gameScore = 0; updateScore(); m_startButton.setVisibility(View.GONE); m_timeToStartText.setVisibility(View.VISIBLE); startPreTimer(); } }); }

    Read the article

  • Programming an Android Button to update EditText views

    - by bergler77
    Ok guys, I have a button in android that i'm trying to use to update 8 EditText Views with different random numbers. Everything works up until I click the button. It appears I am missing a resource according to the debugger, but I'm not sure what. I've tried several different ways of implementing the button. Here is what I have after looking at several posts. import java.util.Random; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MyCharNewChar extends MyCharActivity { private OnClickListener randomButtonListener = new OnClickListener(){ public void onClick(View v) { //Button creates a set of random numbers and updates the values //of the EditText views. Random rand = new Random(); int STR = 1 + rand.nextInt(12); int AGI = 1 + rand.nextInt(12); int DEX = 1 + rand.nextInt(12); int WIS = 1 + rand.nextInt(12); int INT = 1 + rand.nextInt(12); int CON = 1 + rand.nextInt(12); int HP = 1 + rand.nextInt(20); int AC = 1 + rand.nextInt(6); EditText str = (EditText) findViewById(R.id.str); str.setText(STR); EditText agi = (EditText) findViewById(R.id.agi); agi.setText(AGI); EditText dex = (EditText) findViewById(R.id.dex); dex.setText(DEX); EditText wis = (EditText) findViewById(R.id.wis); wis.setText(WIS); EditText intel = (EditText) findViewById(R.id.intel); intel.setText(INT); EditText con = (EditText) findViewById(R.id.con); con.setText(CON); EditText hp = (EditText) findViewById(R.id.baseHP); hp.setText(HP); EditText ac = (EditText) findViewById(R.id.baseAC); ac.setText(AC); } }; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.newchar); Button randomButton = (Button) findViewById(R.id.randomButton); randomButton.setOnClickListener(randomButtonListener); } } Here is the xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayoutNew1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/background" > <TextView android:id="@+id/newCharLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/new_character_screen" android:textSize="24dp" android:textColor="@color/splash" android:textStyle="bold" android:gravity="center"/> <TextView android:id="@+id/nameLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/nameLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputType="textPersonName" > <requestFocus /> </EditText> <TableLayout android:id="@+id/statsLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp"> <TableRow android:id="@+id/tableRow01" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp"> <TextView android:id="@+id/strLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/strLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/str" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number" /> <TextView android:id="@+id/agiLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/agiLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/agi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> <TextView android:id="@+id/dexLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/dexLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/dex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> </TableRow> <TableRow android:id="@+id/tableRow02" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp"> <TextView android:id="@+id/intLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/intLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/intel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> <TextView android:id="@+id/wisLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/wisLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/wis" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> <TextView android:id="@+id/conLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/conLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/con" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> </TableRow> </TableLayout> <LinearLayout android:id="@+id/linearlayoutNew02" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:gravity="center"> <TextView android:id="@+id/baseHPLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hpLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/baseHP" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> <TextView android:id="@+id/baseACLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/acLabel" android:textSize="18dp" android:textColor="@color/splash"/> <EditText android:id="@+id/baseAC" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="3" android:inputType="number"/> </LinearLayout> <LinearLayout android:id="@+id/linearlayoutNew03" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/randomButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/randomButton" android:textSize="16dp" android:clickable="true"/> </LinearLayout> </LinearLayout> I have also tried setting the onClick in xml to setup a specific onClick method. Still the same error so I must have a problem elsewhere. Any suggestions would be great!

    Read the article

  • Android Uncaught Exception

    - by Agrim Asthana
    09-30 02:32:31.474: D/ddm-heap(214): Got feature list request 09-30 02:32:31.634: D/AndroidRuntime(214): Shutting down VM 09-30 02:32:31.634: W/dalvikvm(214): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 09-30 02:32:31.634: E/AndroidRuntime(214): Uncaught handler: thread main exiting due to uncaught exception 09-30 02:32:31.654: E/AndroidRuntime(214): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mjcet.mjcet/com.mjcet.mjcet.MJCET}: java.lang.ClassNotFoundException: com.mjcet.mjcet.MJCET in loader dalvik.system.PathClassLoader@44e8c820 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.os.Handler.dispatchMessage(Handler.java:99) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.os.Looper.loop(Looper.java:123) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.main(ActivityThread.java:4363) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.reflect.Method.invokeNative(Native Method) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.reflect.Method.invoke(Method.java:521) 09-30 02:32:31.654: E/AndroidRuntime(214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 09-30 02:32:31.654: E/AndroidRuntime(214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 09-30 02:32:31.654: E/AndroidRuntime(214): at dalvik.system.NativeStart.main(Native Method) 09-30 02:32:31.654: E/AndroidRuntime(214): Caused by: java.lang.ClassNotFoundException: com.mjcet.mjcet.MJCET in loader dalvik.system.PathClassLoader@44e8c820 09-30 02:32:31.654: E/AndroidRuntime(214): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409) 09-30 02:32:31.654: E/AndroidRuntime(214): ... 11 more 09-30 02:32:31.684: I/dalvikvm(214): threadid=7: reacting to signal 3 09-30 02:32:31.684: E/dalvikvm(214): Unable to open stack trace file '/data/anr/traces.txt': Permission denied the above is my debugging output for the below activities LOGINACTIVITY.java package com.agrim.mjcet; import com.agrim.mjcet.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; //import android.widget.TextView; import android.widget.Button; import android.widget.EditText; import android.view.View.OnClickListener; public class LoginActivity extends Activity { EditText txtUserName; EditText txtPassword; Button btnLogin; Button btnCancel; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setting default screen to login.xml setContentView(R.layout.main); txtUserName=(EditText)this.findViewById(R.id.txtUname); txtPassword=(EditText)this.findViewById(R.id.txtPwd); btnLogin=(Button)this.findViewById(R.id.btnLogin); btnLogin=(Button)this.findViewById(R.id.btnLogin); btnLogin.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Switching to Register screen if((txtUserName.getText().toString()).equals(txtPassword.getText().toString())) { Intent myIntent = new Intent(getApplicationContext(),SampleActivity.class); startActivityForResult(myIntent, 0); } } } ); } } SAMPLE ACTIVITY.java package com.agrim.mjcet; import com.agrim.mjcet.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class SampleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set View to register.xml setContentView(R.layout.lol); TextView HomeScreen = (TextView) findViewById(R.id.back); HomeScreen.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // Closing registration screen // Switching to Login Screen/closing register screen finish(); } }); } } and here are my 2 layouts MAIN.XML <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" android:stretchColumns="1"> <TableRow> <TextView android:text="@string/user_name" android:textColor="#347235" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_marginLeft="25dip" android:layout_height="wrap_content"> </TextView> <EditText android:text="" android:inputType="text" android:id="@+id/txtUname" android:layout_weight="0.75" android:layout_width="wrap_content" android:layout_marginRight="10dip" android:layout_marginBottom="5dip" android:background="#FFFFFF" android:layout_height="wrap_content"> </EditText> </TableRow> <TableRow> <TextView android:text="@string/password" android:textColor="#347235" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dip"> </TextView> <EditText android:text="" android:inputType="textPassword" android:id="@+id/txtPwd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dip" android:layout_weight="1" android:background="#FFFFFF" android:gravity="center"> </EditText> </TableRow> <TableRow> <Button android:id="@+id/btnLogin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:layout_marginTop="25dip" android:layout_marginLeft="50dip" android:onClick="onClickMyButton" android:text="@string/login" /> <Button android:id="@+id/btnCancel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:layout_marginTop="25dip" android:layout_marginLeft="100dip" android:layout_marginRight="50dip" android:text="@string/cancel" /> </TableRow> <FrameLayout android:layout_width="wrap_content" android:layout_height="match_parent" > <ImageView android:layout_width="fill_parent" android:layout_height="match_parent" android:scaleType="centerInside" android:src="@drawable/logo_invert" android:contentDescription="@drawable/logo_invert"/> </FrameLayout> </TableLayout> and finally LOL.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:background="#000000" android:layout_height="fill_parent" > <ImageView android:layout_width="fill_parent" android:id="@+id/back" android:layout_height="match_parent" android:scaleType="centerInside" android:src="@drawable/lol" android:contentDescription="@drawable/lol"> </ImageView> <RelativeLayout android:layout_width="match_parent" android:layout_height="138dp" android:orientation="vertical" android:gravity="bottom" > <TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="@string/coming_soon" android:textColor="#347235" /> </RelativeLayout> </FrameLayout> I get a force close upon initialization.. and yes this is my first android app :)

    Read the article

  • Android layout issue - relative widths in percent using weight

    - by cdonner
    I am trying to assign relative widths to columns in a ListView that is in a TabHost, using layout_weight as suggested here: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableLayout android:id="@+id/triplist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="4px"> <TableRow> <ListView android:id="@+id/triplistview" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </TableRow> <TableRow> <Button android:id="@+id/newtripbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Add Trip"/> </TableRow> [other tabs ...] My row definition has 4 columns that I would like to size as follows: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="1.0" android:padding="4px"> <TextView android:id="@+id/rowtripdate" android:layout_weight=".2" android:layout_width="0dip" android:layout_height="wrap_content" android:inputType="date"/> <TextView android:id="@+id/rowodostart" android:layout_weight=".2" android:layout_width="0dip" android:layout_height="wrap_content"/> <TextView android:id="@+id/rowodoend" android:layout_weight=".2" android:layout_width="0dip" android:layout_height="wrap_content"/> <TextView android:id="@+id/rowcomment" android:layout_weight=".4" android:layout_width="0dip" android:layout_height="wrap_content"> Unfortunately, it seems to want to fit all the columns into the space that the button occupies, as opposed to the width of the screen. Or maybe there is another constraint that I do not understand. I'd appreciate your help.

    Read the article

  • Android layout issue - relative widths

    - by cdonner
    I am trying to assign relative widths to columns in a ListView that is in a TabHost, using layout_weight as suggested here: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableLayout android:id="@+id/triplist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="4px"> <TableRow> <ListView android:id="@+id/triplistview" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </TableRow> <TableRow> <Button android:id="@+id/newtripbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Add Trip"/> </TableRow> [other tabs ...] My row definition has 4 columns that I would like to size as follows: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="1.0" android:padding="4px"> <TextView android:id="@+id/rowtripdate" android:layout_weight=".2" android:layout_width="0dip" android:layout_height="wrap_content" android:inputType="date"/> <TextView android:id="@+id/rowodostart" android:layout_weight=".2" android:layout_width="0dip" android:layout_height="wrap_content"/> <TextView android:id="@+id/rowodoend" android:layout_weight=".2" android:layout_width="0dip" android:layout_height="wrap_content"/> <TextView android:id="@+id/rowcomment" android:layout_weight=".4" android:layout_width="0dip" android:layout_height="wrap_content"> Unfortunately, it seems to want to fit all the column into the space that the button occupies, as opposed to the width of the screen. Or maybe there is another constraint that I do not understand. I'd appreciate your help.

    Read the article

  • ASP.NET page content doesn't change

    - by WtFudgE
    Hi, I created an application which has a menu where it's items are created dynamicly. The menu acts as a language menu. <body runat="server"> <form id="Form1" runat="server"> <table class="TableLayout"> <tr> <td class="TopNav" align="right"> <asp:Menu runat="server" ID="LanguageMenu" Orientation="Horizontal" OnMenuItemClick="LanguageMenu_MenuItemClick"> <LevelMenuItemStyles> <asp:MenuItemStyle CssClass="TopNavItem" /> </LevelMenuItemStyles> <StaticHoverStyle CssClass="TopNavItemHover" /> </asp:Menu> </td> </tr> ... I use session variables to set my current language. however if I click on the menu to change the session variable: public void LanguageMenu_MenuItemClick(Object sender, MenuEventArgs e) { Session["language"] = e.Item.Text; } The page reloads with the following code: sportsPath = String.Format(@"{0}{1}\Sports\", xmlPath, Session["language"]); //create LeftNavigation string[] sports = Directory.GetFiles(sportsPath); LeftNavigation.Items.Clear(); foreach (string sport in sports) { string text = sport.Replace(sportsPath, "").Replace(".xml", ""); MenuItem item = new MenuItem(); item.Text = text; LeftNavigation.Items.Add(item); } The thing is the content doesn't change, only after I click on something else. If I skip through my code after clicking on the menuItem I can see that it passes the code and it should change, however for some reason the page needs another extra trigger to modify it's content. I also see the page reloading so I don't understand why it's not changing immediatly. I guess I'm not understanding the asp.net logic just quite yet. What am I doing wrong?

    Read the article

  • Need help in support multiple resolution screen on android

    - by michael
    Hi, In my android application, I would like to support multiple screens. So I have my layout xml files in res/layout (the layout are the same across different screen resolution). And I place my high-resolution asserts in res/drawable-hdpi In my layout xml, I have <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/table" android:background="@drawable/bkg"> And I have put bkg.png in res/drawable-hdpi And I have started my emulator with WVGA-800 as avd. But my application crashes: E/AndroidRuntime( 347): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020023 a=-1 r=0x7f020023} E/AndroidRuntime( 347): at android.content.res.Resources.loadDrawable(Resources.java:1677) E/AndroidRuntime( 347): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) E/AndroidRuntime( 347): at android.view.View.<init>(View.java:1850) E/AndroidRuntime( 347): at android.view.View.<init>(View.java:1799) E/AndroidRuntime( 347): at android.view.ViewGroup.<init>(ViewGroup.java:284) E/AndroidRuntime( 347): at android.widget.LinearLayout.<init>(LinearLayout.java:92) E/AndroidRuntime( 347): ... 42 more Does anyone know how to fix my problem? Thank you.

    Read the article

  • Positioning problem in VIsta when Aero Theme is enabled

    - by Adeel Rehman
    Hi, I have a Windows form which has tab pages. On a Tab Page, I have a Combo Box. When I click the combobox a drop down opens up just below the combo box to give the impression of a drop down. The drop down is a windows form and this is how I set its position Popup.Location = control.PointToScreen(parentcontrol.PointToClient(new System.Drawing.Point(0, control.Height))); Popup = drop down that opens below the combo box (Windows Form) control = my combo box (Combo Box) parentcontrol = the windows form on which the control is present (Parent Form) Problem:- The X coordinate is not plotted correctly on the screen with Aero theme enabled. This works perfectly fine on XP (with some variance in y due to tablelayout panel i assume). But when i use the same code on Vista with Aero theme enabled the x-cordinate wanders away about 20-30 pixels. If I Turn Aero theme off on Vista, it works fine. I have found the X and Y coordiantes calculated in both cases are the same. But the way Vista draws these coordinates on the screen (when aero theme is enabled) is different. Is there any solution to this problem? Thanks, Adeel Rehman.

    Read the article

  • How to set padding to columns in table layout dynamically

    - by Praveenb
    Hi all, I am trying to create a table layout with buttons dynamically. I am able to get the table layout with buttons. bt i need padding between buttons. How i can get programatically. I tried following code bt private void showCowsTblField() { for (int row = 0; row < numberOfRowsInField-1; row++) { TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT )); for (int column = 0; column < numberOfColumnsInField -1; column++) { blocks[row][column].setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); blocks[row][column].setPadding(blockPadding, blockPadding, blockPadding, blockPadding); tableRow.addView(blocks[row][column]); tableRow.setPadding(blockPadding, blockPadding, blockPadding, blockPadding); } tblCows.addView(tableRow,new TableLayout.LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); } } Please let me know.... Thanks.

    Read the article

  • Find Control in Grid

    - by Eric
    I have a RadGrid with radio buttons on the inside of a FormTemplate. I want hide the panels below or show the panels below on checkchanged of the radio button. However, my issue is that i don't know how to access the panels oncheckchanged. Any help would be appreciate. Thanks in advance. protected void RadioButtonCompany_CheckChanged(object sender, EventArgs e) { RadioButton RadioButtonCompany = (RadioButton)sender; Panel pnlPerson = (Panel)RadGridInjuries.Items[1].FindControl("pnlPerson"); Panel pnlcomp = (Panel)RadGridInjuries.MasterTableView.FindControl("pnlComp"); if (RadioButtonCompany.Checked) { pnlPerson.Visible = false; pnlcomp.Visible = true; } else { pnlPerson.Visible = true; pnlcomp.Visible = false; } } <telerik:RadGrid ID="RadGridInjuries" DataSourceID="DSource"> <GroupingSettings CaseSensitive="false" /> <SelectedItemStyle CssClass="Cursor" /> <ItemStyle CssClass="Cursor" /> <MasterTableView TableLayout="Auto" CssClass="Cursor" CanRetrieveAllData="true" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="false" GridLines="Both" runat="server"> <ItemStyle CssClass="Cursor" /> <EditFormSettings EditFormType="Template" > <FormTemplate> <table id="Table2" width="100%" border="0" rules="none" style="border-collapse: collapse;background:#F0F0F0"> <tr> <td style="font-size: medium;color:Blue"> <b>Provider Details Information</b></td> </tr> <tr><td><br /></td></tr> <tr> <td> <asp:RadioButton ID="RadioButtonCompany" OnCheckedChanged="RadioButtonCompany_CheckChanged" runat="server" Text="Company" GroupName="Type" AutoPostBack="true" /> <asp:RadioButton ID="RadioButtonPerson" runat="server" Text="Person" GroupName="Type" AutoPostBack="true" /> </td> </tr> <tr><td><br /></td></tr> <tr> <td align="center"> <asp:Panel ID="pnlPerson" runat="server" Visible="false"> //stuff in here <asp:/Panel> <asp:Panel ID="pnlCompany" runat="server" Visible="false"> //stuff in here <asp:/Panel> </FormTemplate> </EditFormSettings> </MasterTableView> <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="false"> <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> <ClientEvents /> </ClientSettings> </telerik:RadGrid>

    Read the article

  • Android - Retrieve all data from a SQLite table row

    - by Paul
    I have searched and cannot find an answer to my issue so i hope i am not completely barking up the wrong tree (so to speak). I am new to android and have started to create an app. My app on one screen creates and adds entries to a SQLite database using public class DatabaseHandler extends SQLiteOpenHelper and this all appears to work. I retrieve all the data and populate it into a grid, again this now works. My issue is I am unable to retrieve one complete line from the grid. I populate/display the grid with the following code. I have cut a lot out as the grid is made in stages, header, blank lines etc but the grid does display as I want. The id’s work as when I touch a line it displays its unique id. The onClick is right at the end and when I use getText() instead of getID() all it returns is the data in the labelDate. How do I retrieve all the labels as listed below? TextView labelDATE = new TextView(this); TextView labelCP = new TextView(this); TextView labelBG = new TextView(this); TextView labelQA = new TextView(this); TextView labelCN = new TextView(this); TextView labelKT = new TextView(this); TextView[] tvArray = {labelDATE, labelCP, labelBG, labelQA, labelCN, labelKT}; labelDATE.setText(re.getTime()); labelCP.setText(re.getCP()); labelBG.setText(re.getBG()); labelQA.setText(re.getQA()); labelCN.setText(re.getCN()); labelKT.setText(re.getKT()); for (TextView tv : tvArray) { tv.setTextColor(Color.WHITE); tv.setId(200+count); tr.setOnClickListener(this); tr.addView(tv); } //add this to the table row tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); public void onClick(View v) { if (v instanceof TableRow) { TableRow row = (TableRow) v; TextView child = (TextView) row.getChildAt(0); Toast toast = Toast.makeText(this, String.valueOf(child.getId()), Toast.LENGTH_SHORT); toast.show(); } } I can supply all the code for the grid creation if required. Thanks for any help.

    Read the article

  • Error reading values from dynamically created table rows in Android

    - by jaymo
    So I have a couple of dynamically created tablerows.Each TableRow has a couple of Textviews.I have a button that on clicked should get all the values of the second and third textviews in each Tablerow in the Table. I have tried to do this using the code below mSubmitOrders.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(mTable.getChildCount()>1){ for(int i = 0; i < mTable.getChildCount(); i++){ TableRow tr = (TableRow)mTable.getChildAt(i); TextView code = (TextView) tr.getChildAt(1); TextView quantity = (TextView) tr.getChildAt(2); String Scode = code.getText().toString(); Log.i("TAG", Scode); String Squantity = quantity.getText().toString(); Log.i("TAG", Squantity); } } But I get the below errors (Logcat below). Assistance required 10-22 09:00:16.345: E/AndroidRuntime(4495): FATAL EXCEPTION: main 10-22 09:00:16.345: E/AndroidRuntime(4495): java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView 10-22 09:00:16.345: E/AndroidRuntime(4495): at com.symetry.myitprovider.ui.actual$4.onClick(actual.java:173) 10-22 09:00:16.345: E/AndroidRuntime(4495): at android.view.View.performClick(View.java:3131) 10-22 09:00:16.345: E/AndroidRuntime(4495): at android.view.View$PerformClick.run(View.java:12035) 10-22 09:00:16.345: E/AndroidRuntime(4495): at android.os.Handler.handleCallback(Handler.java:587) 10-22 09:00:16.345: E/AndroidRuntime(4495): at android.os.Handler.dispatchMessage(Handler.java:92) 10-22 09:00:16.345: E/AndroidRuntime(4495): at android.os.Looper.loop(Looper.java:132) 10-22 09:00:16.345: E/AndroidRuntime(4495): at android.app.ActivityThread.main(ActivityThread.java:4123) 10-22 09:00:16.345: E/AndroidRuntime(4495): at java.lang.reflect.Method.invokeNative(Native Method) 10-22 09:00:16.345: E/AndroidRuntime(4495): at java.lang.reflect.Method.invoke(Method.java:491) 10-22 09:00:16.345: E/AndroidRuntime(4495): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844) 10-22 09:00:16.345: E/AndroidRuntime(4495): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 10-22 09:00:16.345: E/AndroidRuntime(4495): at dalvik.system.NativeStart.main(Native Method) EDIT: I have modified my code and now there is no error..but its not working as needed.. The new code is as below.. mSubmitOrders.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(mTable.getChildCount()>1){ for(int i = 0; i < mTable.getChildCount(); i++){ //TODO: Figure out how to do this well LinearLayout LL = (LinearLayout)mTable.getChildAt(i); View x = ((View)(LL.getParent()).getParent()); Log.i("TAG", "Past view"); TextView code = (TextView)((ViewGroup) x).getChildAt(2); String Scode = code.getText().toString(); Log.i("TAG", Scode); } But thing is its not getting the texview from TableLayout's Table Row..its getting a different one...the one I have circled in the picture ![Error]:http://semasoftltd.com/error.png

    Read the article

  • Android RatingBar weirdness: Whenever I add a RatingBar to my layout, a bunch of the generated tags,

    - by Rben
    Whenever I use a RatingBar view in my layout, I suddenly get all kinds of compile errors. I'm using Android 2.0, but I've also tried 2.0.1, and 2.1, without joy. I also get a message: Shader 'android.graphics.BitmapShader' is not supported in Layout Editor, and an odd warning which may or maynot be related: warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. I've tried using the RatingBar both within a tablelayout and outside it, but it behaves the same way. This is very puzzling and frustrating. Please help if you can. Sincerely, Ray Here's the XML: <!-- Created By --> <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" > <TextView android:text="Created by: " android:id="@+id/gi_created_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" /> <TextView android:text="Slartibartfast" android:id="@+id/gi_created" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </TableRow> <!-- Verification --> <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" > <TextView android:id="@+id/gi_verification_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/GameInfoVerificationLabelText" /> <TextView android:id="@+id/gi_verification" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="HonorSystem" /> </TableRow> <!-- Player Rating Label --> <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="@string/GameInfoPlayerRatingLabel" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=" " /> </TableRow> -- <!-- Times played --> <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" > <TextView android:id="@+id/gi_times_played_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/GameInfoTimesPlayedLabel" /> <TextView android:id="@+id/gi_times_played" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="999" /> </TableRow> <!-- Total Players --> <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" > <TextView android:id="@+id/gi_total_players_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/GameInfoTotalPlayerCountLabel" /> <TextView android:id="@+id/gi_total_players" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="999" /> </TableRow> <!-- Total Cancelations --> <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" > <TextView android:id="@+id/gi_total_cancelations_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/GameInfoTotalCancelsLabel" /> <TextView android:id="@+id/gi_total_cancels" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="999" /> </TableRow> <RatingBar android:id="@+/gi_player_rating" style="?android:attr/ratingBarStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_span="2" android:isIndicator="true" android:numStars="5" android:rating="3" android:stepSize="1" android:layout_gravity="center_vertical" /> </TableRow>

    Read the article

< Previous Page | 1 2 3 4