Hii all I am not good at designing. I need help with the following layout.
1-How to add the images right next to pay(Subscription) , like we add badge?
2-How to set the view , like it is when we select an item in the image below? Showing a light blue marker at the start of it.
3-How to add the bottom blue footer line?
P.s. My navigation view is also very slow. Any tips on that would be helpful too.
While Initializing my navigation drawer , I did this.
gallery=(TextView) MenuItemCompat.getActionView(navigationView.getMenu().
findItem(R.id.menu__pay_subscription));
initializeCountDrawer();
Then The method.
private void initializeCountDrawer(){
gallery.setGravity(Gravity.CENTER_VERTICAL);
gallery.setTypeface(null, Typeface.BOLD);
gallery.setTextColor(getResources().getColor(R.color.colorAccent));
Drawable img = context.getResources().getDrawable( R.drawable.cards);
img.setBounds( 0, 0, 200, 40 );
gallery.setCompoundDrawables( img, null, null, null);
}
Related
today i need help from you!
I have a recyclerview with some data(get from json), with adapter.
I have some button(with id) with a drawable left, and onclick on the button i execute this for the clicked button :
Drawable image = ContextCompat.getDrawable(context, R.drawable.active);
image.setBounds(0, 0, 70, 70);
Button.setCompoundDrawables(image, null, null, null);
I Change the drawable with a new drawable.
My question is now.
When i click on some button in the list, and i scroll, the button return to default drawable... WHY?
Thanks every one for help!
Resolve with movies.add(new Costructor("","","","","","",""));
When you scroll RecyclerView then all data reset with Adapter's data.
When you click and change Drawable with R.drawable.active, It will change only in screen for temporary.
Please update Adapter's data.
now I use canvas(ondraw()) to draw images of my app and if I want to show some
list in center of my app. What should I suppose to do? I have 2 ideas.
Add ListView in Dialog, but the screen is dark, which I don't want it to be.
Add ListView in LinearLayout and make it to Bitmap which I can't draw image, my
code is this following:
ListView modeList = new ListView(context);
modeList.setAdapter(new ImageAdapter(context, objects));
linearlayout = new LinearLayout(context);
linearlayout.setOrientation(LinearLayout.VERTICAL);
linearlayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
linearlayout.addView(modeList);
linearlayout.layout(0, 0, 200, 200);
linearlayout.measure((int)Define.getScreenWidth(), (int)Define.getScreenHeight());
linearlayout.setDrawingCacheEnabled(true);
linearlayout.buildDrawingCache(true);
and when I draw
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(linearlayout.getDrawingCache(), 200, 200, null);
}
However, it draws nothing :(
First way deffenately better, you could style Dialog to become borderless and with translucenbt background. Check this link.
+1 vote for the first way. Style your dialog and disable dark background.
Second way is overcomplicated. You better add listview as a child directly to a current window, so it will be drawn on top of all other views, or place all your views in framelayout and add listview to that framelayout, so it will be on top of all previously added views.
I have tab layout.That has only icons not text.I tried with clickOnImageButton and ClickOnButton clickOnImage and also pressOnMenuItem(R.drwable.icon)but not worked.How can i do this with solo?
Note: Image View present at the top of the tab.(tab is at bottom)
Tabhosts are evil. Luckily i also have had to automate them and so know the answer.
what you do is you have to get the tab bar view (android.R.id.tabs) and then cast it to a Tabhost or a ViewGroup then you can get each of the tabs via .getChildAt(x) where x is the index of the tabs.
ViewGroup tabs = (ViewGroup) solo.getView(android.R.id.tabs);
View viewYouWantToDoStuffWith = tabs.getChildAt(x); //change x to the index you want.
In your case you would then want something like:
solo.clickOnView(viewYouWantToDoStuffWith);
you can use method solo.clickOnView(solo.getView(resourceId));
where resourceId could be something like R.id.id_Of_Button.
see this link in that they are using image + text. so remove the text made as image that you have to do it.
http://www.androidhive.info/2011/08/android-tab-layout-tutorial/
this is only for text you can set that with image and made as custom tab.
http://www.androidpeople.com/android-tabhost-tutorial-part-1
Hope it will work for you .
I am trying to insert a textview inside a Edittext as in below
can anyone pls give me ideas about how to implement it or something.
thanks :)
update:
the textviews in the edittext will vary dynamically.
Try this sample code. It fits your requirement.
PopupWindow pw = new PopupWindow(
this.getViewInflate().inflate(R.layout.pw_layout,
null, true, null),
100,100,true);
// display the popup in the center
pw.showAtLocation(layout, Gravity.CENTER, 0, 0);
pw.update(20,20,100,100);
For the views inside EditText part, you 'll have to extend the EditText. Overview of how it should look is as follows.
class emailEditText extends EditText {
List<NamePhotoView> ViewlistOfSelectedContacts; // create new
void addContact(String name, Bitmap photo) {
// create a new 'NamePhotoView' and add to the ViewlistOfSelectedContacts
}
#Override
void onDraw(Canvas canvas) {
for (....) {
// draw all views from the list. left to right.
}
// you have to some how offset the text start coordinate. then call super
super.onDraw(canvas);
}
}
I think you cannot set TextView inside EditText.
But alternatively you can make it look that way. Here are the steps
convert textview to BitmapDrawable
convert bitmap drawable into SpanableString (ImageSpan)
then set this returned SpannableString to your EditText
I have recently completed this kind of ui and i have explained in my blog Making GoSmsPro/Evernote like EditText
The way Android implements it, the so called Chips UI, can be found here.
Essentially it's a custom span that draws the components (image, text, etc.) over the text, plus some logic to show the popup.
you can create a component based on what you need like you mentioned above with frame layout. You may have a FrameLayout or RelativeLayout with two views such as EditText and TextView while text view is on top of EditText. also you can put image view if you want in right like your picture.
Although you don't need to create a component and easily you can do this in your XML layout, if you have plan to use it regularly through your application it is good practice to create those views as a component.
I want my application to have button bar at the bottom, that is similar to this one (Motorola Defy+):
How can this be achieved? I've tried ButtonBar style with regular buttons in it, but they always have margin in this case.
By code:
Make the bar LinearLayout horizontal. Let´s say its name in code will be bbll.
LinearLayout.LayoutParams params = bbll.LayoutParams();
params.leftMargin=0;
params.rightMargin=0;
... or params.setMargins(0, 0, 0, 0);
bbll.setLayoutParams(params);
By layout simply set each margin to 0. That's all. If you have done it and it won't work, put the code here, please.
But you should set bbll.setPadding(0,0,0,0) , too. Or you'll see empty space between the bar (that is invisible) and the buttons. aqs has a good thought.