[Solved] Layout Designing – Android

In this i used a table layout to achieve your requirement…..In src you place your image from drawable… <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <RelativeLayout android:layout_width=”fill_parent” android:layout_height=”150dp” > <TextView android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”#c8c8c8″ /> </RelativeLayout> <TableRow android:id=”@+id/tableRow1″ android:layout_width=”match_parent” android:layout_height=”wrap_content” > <ImageView android:id=”@+id/TextView04″ android:layout_weight=”1″ android:background=”#dcdcdc” android:gravity=”center” android:padding=”20dip” android:text=”Row 2 column 1″ android:textColor=”#000000″ android:src=”https://stackoverflow.com/questions/37128554/@drawable/swara”/> <ImageView … Read more

[Solved] Dressing a mannequin with different items in android

Use Constraint Layout it will be easy for you to Design your Requirement Add this dependency in your Project compile ‘com.android.support.constraint:constraint-layout:1.0.2’ Here I have added a code for your design <?xml version=”1.0″ encoding=”utf-8″?> <android.support.constraint.ConstraintLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent”> <ImageView android:id=”@+id/imageView3″ android:layout_width=”0dp” android:layout_height=”0dp” android:scaleType=”fitXY” app:layout_constraintBottom_toBottomOf=”parent” app:layout_constraintHorizontal_bias=”1.0″ app:layout_constraintLeft_toLeftOf=”parent” app:layout_constraintRight_toLeftOf=”@+id/guideline4″ app:layout_constraintTop_toTopOf=”parent” app:layout_constraintVertical_bias=”1.0″ app:srcCompat=”@drawable/splash” /> <android.support.constraint.Guideline android:id=”@+id/guideline4″ android:layout_width=”wrap_content” … Read more

[Solved] How do I create a ListView like the YouTube App? [closed]

The most important thing to apply this kind of design is properly implement adapter, which will represent every piece of data (one video in your situation). More or less in for situation it will look like: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content”> //you main picture <ImageView android:layout_width=”fill_parent” android:layout_height=”fill_parent”> //layout to place other info like number of likes, … Read more

[Solved] button.setOnClickListener not working

Just set onClick in the XML, it’s much easier. android:onClick=”whatever” Then in your class, public void whatever(View v) { // Do your stuff } You do not need all this: button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { image.setImageResource(R.drawable.player_pause); } }); 1 solved button.setOnClickListener not working

[Solved] How to make bitmap invisible ontouch in android? [closed]

Do this : @Override public boolean onTouch(final View view, MotionEvent event) { final int action = event.getAction(); int x = event.getX() // or getRawX(); int y = event.getY(); switch(action){ case MotionEvent.ACTION_DOWN: if (x >= xOfYourBitmap && x < (xOfYourBitmap +yourBitmap.getWidth()) && y >= yOfYourBitmap && y < (yOfYourBitmap + yourBitmap.getHeight())) { //You’ve pressed on your … Read more

[Solved] How to get current layout on android? [closed]

Try these: View currentView = this.getWindow().getDecorView().findViewById(android.R.id.content) or View currentView = this.findViewById(android.R.id.content) or View currentView = this.findViewById(android.R.id.content).getRootView() or You can get the view if you put an id to each of your layout file’s root tag like below: <RelativeLayout android:id=”@+id/rl_root_one” And then get the view: RelativeLayout relativeLayout = (RelativeLayout)findViewById(R.id.rl_root_one); Using any of the above methods you … Read more

[Solved] how to design form like google calender event in android? [closed]

You can achieve that by using PercentageRelativeLayout. Try this XML code: <?xml version=”1.0″ encoding=”utf-8″?> <android.support.percent.PercentRelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent” android:padding=”20dp” android:layout_margin=”10dp”> <android.support.percent.PercentRelativeLayout android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/from_layout” android:layout_margin=”5dp”> <TextView android:text=”FROM” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/textView8″ android:textSize=”24sp” style=”@android:style/Widget.DeviceDefault.Light.TextView” /> <Spinner app:layout_widthPercent=”60%” android:layout_height=”wrap_content” android:id=”@+id/spinner2″ android:layout_below=”@+id/textView8″ android:spinnerMode=”dialog” style=”@style/Platform.Widget.AppCompat.Spinner” /> <Spinner app:layout_widthPercent=”40%” android:layout_height=”wrap_content” android:id=”@+id/spinner4″ android:layout_toRightOf=”@+id/spinner2″ android:gravity=”start” android:layout_below=”@+id/textView8″ android:spinnerMode=”dialog” style=”@style/Platform.Widget.AppCompat.Spinner” /> </android.support.percent.PercentRelativeLayout> … Read more

[Solved] How to fill with dots in a view? [closed]

You have to achive this through the tileMode. put this image file on your drawable folder then drawable/dot_background.xml: <?xml version=”1.0″ encoding=”utf-8″?> <bitmap xmlns:android=”http://schemas.android.com/apk/res/android” android:src=”https://stackoverflow.com/questions/48047303/@drawable/actual_pattern_image” android:tileMode=”repeat” /> then set this xml as background on your view hope this will help help you solved How to fill with dots in a view? [closed]

[Solved] How divide space between Bottom Navigation View?

I need to create Bottom Navigation with two menu item. but the view ratio is 30:70 and text gravity is in centre. one menu contain image and text one is only text AFAIK you can not achieve using menu better to create custom layout for this Sample code <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:gravity=”center” android:layout_margin=”10dp” android:layout_alignParentBottom=”true” android:orientation=”horizontal” … Read more

[Solved] Android background default when pressed object [closed]

Create a ripple_effect.xml file and add following code. res/drawable/ripple_effect.xml <?xml version=”1.0″ encoding=”utf-8″?> <ripple xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:color=”#f816a463″ tools:targetApi=”lollipop”> <item android:id=”@android:id/mask”> <shape android:shape=”rectangle”> <solid android:color=”#f816a463″ /> </shape> </item> </ripple> see the link : http://www.viralandroid.com/2015/09/how-to-add-ripple-effect-to-android-button.html implement it in your code where you want to add effect. solved Android background default when pressed object [closed]

[Solved] My android application is getting stopped

Go to the your Manifest file and do this in the activity where you want to show the Toolbar <activity android:name=”.YourActivity” android:theme=”@style/AppTheme.NoActionBar”><!– ADD THIS LINE –> Then in styles.xml add the following: <style name=”AppTheme.NoActionBar”> <item name=”windowActionBar”>false</item> <item name=”windowNoTitle”>true</item> </style> solved My android application is getting stopped

[Solved] What is an Activity in Android? [closed]

Can anyone please explain what is exactly an ‘Activity’ means in Android ? An activity is your main “coarse” unit of user interface. It is roughly analogous to a screen, page, window, or other similar construct in other GUI environments. Or, to quote the documentation: An Activity is an application component that provides a screen … Read more