AryanGupta
(Aryan Gupta)
#1
i am trying to create a vertical arrangement but unable to create.
Hope anyone help me in Creating this extension.
My code
LinearLayout ll = new LinearLayout(context);
ll.setOrientation(LinearLayout.VERTICAL);
ll.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
My Imports
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
this code is not working for me .
AryanGupta
(Aryan Gupta)
#2
sur @Mohamed_Tamer kindly have a look here
AryanGupta
(Aryan Gupta)
#3
Note - please change my Topic category.
You need to add your linearLayout in a ViewGroup
, you might use ViewGroup.add(view)
method.
There isn’t a category for extension development in kodular community, you should ask in the app Inventor community:
2 Likes
AryanGupta
(Aryan Gupta)
#6
the problem is that i am unable to create a Linear Layout
AryanGupta
(Aryan Gupta)
#7
i already used this code
((ViewGroup) layout.getView()).addView(ll);
You didn’t show this code
How? What happens when you use it.
1 Like
AryanGupta
(Aryan Gupta)
#9
it gives me error called - illegal character
Show the log, which character the compiler points to.
1 Like
AryanGupta
(Aryan Gupta)
#11
i don’t know does this can really solve my error.
take ______ = space
previous code
______LinearLayout ll = new LinearLayout(context);
new code
LinearLayout ll = new LinearLayout(context);
Just removed the Space and it works fine
this solve my error . thanks for your time @Mohamed_Tamer
Seems that you was having a special character there, that the compiler failed to resolve it, which got removed when you removed the space
1 Like
AryanGupta
(Aryan Gupta)
#13
sur @Mohamed_Tamer , i am creating a Base Adapter with this Created View which is ll
Linear Layout.
i have store the ll
layout in a Variable - llLayout
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
public class Adapter extends BaseAdapter {
/**
* Constructr
* @param contex
*/
public Adapter(Context context) {
}
public int getCount() {
// TODO Auto-generated method stub
return 10;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View newView = convertView;
if ( newView == null )
{
newView = MyClass.llLayout;
}
return newView;
}
}
please check my code and let me know that this will work or not
AryanGupta
(Aryan Gupta)
#14
please sur @Mohamed_Tamer check this