android-layout

How to implement facebook banner ads in fragment?

﹥>﹥吖頭↗ 提交于 2021-01-29 08:37:40
问题 I am beginner i need to show facebook banner ads in fragment can any one guide how to implement banner ads facebook activity code into fragment? public class YourApplication extends Application { @Override public void onCreate() { super.onCreate(); AudienceNetworkAds.initialize(this); adView = new AdView(this, "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50); LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container); adContainer.addView(adView); adView

How to re-position the grid layout elements in fragments on orientation change?

五迷三道 提交于 2021-01-29 07:11:00
问题 I am having a bottom tabbed activity with three fragments Home, Dashboard and Notifications. In the first fragment, I am having 4 layouts with a button in each layout. These 4 layouts are aligned ina grid view having positions as column:rows (1:1 1:2 2:1 2:2) while in portrait orientation. But how to auto-arrange these layouts when in landscape mode i.e. either as (1:1 1:2 1:3 1:4) based on the horizontal area available during landscape? Xml File <?xml version="1.0" encoding="utf-8"?>

Adding text below/above a switch button in Android menu icon

浪尽此生 提交于 2021-01-29 04:53:57
问题 I am trying to add a text below/above this switch item that is in my Toolbar to indicate functionality of the switch. I was wondering if there is a layout tag I could use to add a text below/above the button. Or is there some other method I have to use. menu_main.xml <menu 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" tools:context=".MainActivity"> <item android:id="@+id/edit"

How to use searchable.xml

て烟熏妆下的殇ゞ 提交于 2021-01-29 04:04:11
问题 I read lots of posts on this but I actually don't understand how it works: I created a searchable.xml in the xml folder: Then I referenced it to my Manifest like this: I can't figure out how can I use it in the search code, I tried with the SearchManager but without success: SearchView searchView; @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate( R.menu.main, menu); MenuItem myActionMenuItem = menu.findItem( R.id.action_search); SearchManager searchManager =

Material TextInputLayout styles are not working

北慕城南 提交于 2021-01-29 03:24:52
问题 Material TextInputLayout styles are not working. I followed the documentation on material textinputlayout here: https://material.io/develop/android/components/text-input-layout/ <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:hint="@string/app

Material TextInputLayout styles are not working

末鹿安然 提交于 2021-01-29 03:20:49
问题 Material TextInputLayout styles are not working. I followed the documentation on material textinputlayout here: https://material.io/develop/android/components/text-input-layout/ <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:hint="@string/app

Popup Menu at bottom of a view

♀尐吖头ヾ 提交于 2021-01-28 21:04:01
问题 How to show Popup menu always at bottom of the anchor view. This is the code I'm using to display popup menu. PopupMenu popup = new PopupMenu(activityReference, view, Gravity.NO_GRAVITY); popup.getMenuInflater() .inflate(R.menu.popup_menu_event_edit, popup.getMenu()); popup.show(); I have tried changinging the Gravity.NO_GRAVITY to Gravity.BOTTOM. But its not working. 回答1: It worked for me PopupMenu attachFilePopup = new PopupMenu(this, view ,Gravity.BOTTOM); attachFilePopup.inflate(R.menu

Popup Menu at bottom of a view

时光怂恿深爱的人放手 提交于 2021-01-28 20:44:04
问题 How to show Popup menu always at bottom of the anchor view. This is the code I'm using to display popup menu. PopupMenu popup = new PopupMenu(activityReference, view, Gravity.NO_GRAVITY); popup.getMenuInflater() .inflate(R.menu.popup_menu_event_edit, popup.getMenu()); popup.show(); I have tried changinging the Gravity.NO_GRAVITY to Gravity.BOTTOM. But its not working. 回答1: It worked for me PopupMenu attachFilePopup = new PopupMenu(this, view ,Gravity.BOTTOM); attachFilePopup.inflate(R.menu

Programmatically set boxBackgroundMode to TextInputLayout

别来无恙 提交于 2021-01-28 20:21:03
问题 I just migrate from com.android.support:design to com.google.android.material . implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.google.android.material:material:1.1.0' I have the troubles with set up boxBackgroundMode as an outline for TextInputLayout programmatically. val textInputLayout = TextInputLayout(this) textInputLayout.addView(EditText(this)) textInputLayout.boxBackgroundMode = TextInputLayout.BOX_BACKGROUND_OUTLINE textInputLayout.boxStrokeColor = Color.BLACK

Finding a resource given its ID - as a variable

喜你入骨 提交于 2021-01-28 19:07:05
问题 Finding a resource in your layout is easy if you know the id: LinearLayout l = FindViewById<LinearLayout>(Resource.Id.linearLayout1); but say I have String id = "linearLayout1"; How can I access the resource IDs and "find" the one I'm looking for? 回答1: You can use this: Resources#getIdentifier() String id = "linearLayout1"; int resourceId = getResources().getIdentifier(id, "id", getPackageName()); Edit: I didn't see the Xamarin tag. I am not familiar with Xamarin, but as far as I know, it